Page

F.5.1- Names and Values

  by NT Community Manager.
Last Updated  by Joel Bush.  

PublicCategorized as Appendix F.

Not tagged.
<< F.5.0- Check BoxesAppendixFF.5.2- Common Errors with Check Boxes >>

Names and Values

In the most common case each check box concerns an independent issue. For example, you can ask customers to check one box if they want a fax confirmation of an order, and to check another box if they want gift wrapping. In these cases, each check box will have its own name, and you won't use the VALUE attribute. Whether data is sent to the server depends on whether the box is checked: if it is checked, the browser will send NAME="on", and if it's not checked nothing will be sent. If you have used the VALUE attribute, then the browser will send Name=Value. Boxes by default are unchecked, but you can change that by adding the CHECKED attribute to the tag.

 

However, you may want the visitor to be able to choose several options from a group of checkboxes. For example, you may be offering to include some of your free catalogs in a shipment of an order of clothing. You could have checkboxes for Hat Catalog, Shoe Catalog, Western Wear Catalog, etc. In the case of allowing multiple selections you make all of the names the same and the values different. The data value sent to the server will consist of the concatenation of all of the values that were checked.

 

In summary, try to remember that for:

 

  • Independent check boxes:
    • Each NAME is different
    • Don't use VALUE
    • Test for NAME="on"

 

  • Grouped check boxes:
    • All NAMES are the same
    • Each box gets its own VALUE
    • Results will be NAME=value1&NAME=value2&NAME=value3
    • Results are also available in a collection Request.QueryString("name")(i)

 

<< F.5.0- Check BoxesAppendixFF.5.2- Common Errors with Check Boxes >>

Copyright © 2003 by Wiley Publishing, Inc.

Powered by Near-TimeTerms of Services | Privacy Policy | Security Policy |