quick server pages
   
Manual page for big(lists)

Handling big lists of checkboxes (etc.)

How can an HTML form get a user's choice from a large list of possibilities? SELECT option lists are one possibility, however they suffer from limitations such as poor readability, lack of formatting, and clumsiness when the list gets long. A big set of RADIO buttons might work, but then we're limited to single choice. What if we need multiple choice? Or, what if we want the user to select "high", "low", or "normal" for selected items? HTML forms provide on/off checkboxes, but these are one per item, and using the QUISP methods shown thus far we would have to enumerate all the checkbox names in the target page in order to capture or process the result.

QUISP solves this problem with the #allresponses directive. The form page should contain a list of response items (in the simplest case these are checkboxes but they can also be SELECTs or RADIO buttons). On the target page, #allresponses may be used to gather all of the checkboxes that have some value (default is on), and build a comma-delimited list of those response field names. This list can then be stored in the database, etc.


Examples

See the live demo on sourceforge.


#allresponses

On a form target page, gather incoming user variables that have a certain value (default is on), and build a comma-delimited list of those variable names.

Usage: #allresponses resultvarname [namepat valuepat]

resultvarname is the name of the QUISP variable where the comma-delimited list of response field names will be placed.

namepat specifies a wildcard pattern that checkbox names must match in order to qualify for the gathering. Use * to match everything. For instance, a namepat of ab_* would include checkboxes named ab_1 and ab_28, but not bc_12.

valuepat specifies a wildcard pattern that submitted form values must match in order to be gathered into the list. Use on to match simple checkboxes that are checked.

If namepat and valuepat are omitted, the default is that all response fields having the value on will be gathered. Note that use of namepat and valuepat allows multiple #allresponses to be used in the same target page.


quick server pages    
Copyright Steve Grubb    


Markup created by unroff 1.0,    April 13, 2004.