Bug 167 - Change to input:checkbox taglib for usage on multi-page forms BugRat Report#220
Summary: Change to input:checkbox taglib for usage on multi-page forms BugRat Report#220
Status: CLOSED WONTFIX
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Input Taglib (show other bugs)
Version: unspecified
Hardware: Other All
: P1 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-10-05 18:38 UTC by August Detlefsen
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomcat Developers Mailing List 2000-10-05 18:38:49 UTC
Current input:checkbox taglib checks for parameters in the request
to determine whether a request is the first hit to a page.

On multi-page forms there will already be values in the request parameters,
even if this is the first hit to a particular page of the form.

My solution is to add a hidden input with a known name to each checkbox generated 
by the taglib. If there is no parameter by that name in the request, 
then you know that this is the first time the page has been hit.

Code:

		//OLD WAY:
		//checking to see if this is the first page hit
		//ie: the request is ENTIRELY empty
		//by: no elements in the request parameters
		//if (!req.getParameterNames().hasMoreElements()) {
		
		//NEW WAY: 
		//checking for the non-existence of the hidden input 
		if (req.getParameter(name + "_cb") == null) {

//do the normal checks to see if it should be checked by default
//...



		//add a hidden input 
		//the presence of its value in the request parameters 
		//will indicate whether this is the first page hit
		out.println("<INPUT TYPE=\"hidden\" NAME=\"" + name + "_cb\" VALUE=\"1\" />");

Comment 1 Shawn Bayern 2001-07-08 00:09:29 UTC
The 'input' library is oriented on (and intended for) single pages.  The 
offered fix makes sense in some contexts, but it's imperfect and might clash 
with a user's parameter.  I think, for now, it's better to keep things simple 
and leave it as it is.