|
Design Tip:
Add Value To Your Forms
by Larisa Thomason,
Senior Web Analyst,
NetMechanic, Inc.
When visitors take the time to send you information via a form on your Web site, you want to receive the data in a useful format. Make sure the information sent by the form is meaningful by assigning VALUE attributes to your checkbox, select list, and radio button elements.
Results You Can Use
Whenever you're offering a visitor multiple options on a form, you have to make sure that you can tell which particular options they selected. Without a VALUE attribute that uniquely identifies each possibility, you'll know the visitor selected something, but not exactly what.
Although you aren't required to include the VALUE attribute in your code, it's implied. If you leave it out, the form submits the information using the element's default value. That often results in less than valuable results.
- Radio Button: ON
- Checkbox: ON
- Select List: 1, 2, 3 etc. It returns the number of the item in the list.
|
If you want to see the problem first hand, fill out the simple form below. We left out all the VALUE attributes when we created it. After you submit the form, check your email for the form results. Take a look to see just how useful those results really are.
Most people will receive form results that look something like this:
Food: onon
Gender: on
Dislikes: 3
submit: Send
Set The Value Of Form Elements
Well obviously, if you're asking for someone's gender, you need a better answer than ON. And if you're trying to put together an acceptable dinner menu, ONONON doesn't help much either.
That problem can easily be solved with the VALUE attribute. Include it for every option in each set as VALUE="value" and you'll get form results that look like this:
Food: okra Rinds
Gender: varies
Dislikes: tuna
submit: Send
So the above form should look like this:
That way, you can be sure to serve your dinner guest (of whatever gender) a tasty mixture of okra and pork rinds - and keep the cat tuna far away from them.
Of course, you could also use a form to collect really valuable information too. And when your visitors take the time to fill out the form, you really want to know what they're telling you. Forget the pork rinds, forget the cat tuna - but don't forget the VALUE attribute!
Learn more about forms at our newsletter archive:
|