|
Posted by Jukka K. Korpela on 12/08/06 11:43
Scripsit Shank:
> My intention is to have the user click a checkbox for each product he
> wants. If I use a text box like the following and enter a 1 for each
> product, submit, no problem.
> The user gets the products he wants.
> <input name="qty" type="text" value="0">
Using a text box might actually be a better option, especially since it
allows the user to order several copies of a product. Whether the text box
should be initialized to "0" or to an empty string is debatable. I'd vote
for the empty string (value="", which is the default), since it makes it
easier to the user to review his order.
Why would you use a checkbox? Admittedly it is faster when using the mouse,
since you can click on the box (if you can - many people suffer from motoric
disabilities that make it difficult to hit such a small box), as opposite to
clicking on a field and pressing "1". On the other hand, people who fill out
a form efficiently, using the keyboard only, using the tab key to move to
the next field, have no essential difference between the two ways.
> However, if I use the following checkbox code, and assuming the user
> checks 4 products half way down the page, he will get the first 4
> products in the recordset. If he clicks 1 checkbox, he will always
> get the first product, not the product he chose.
> <input name="qty" type="checkbox" value="1">
Most probably you have named the elements wrongly. The checkboxes need to
have unique names. If you post the URL, probably someone will tell what's
wrong there.
> Back to basics... what is the fundamental differnce between the text
> box and checkbox?
On fundamental difference is that if a checkbox has not been checked, it
does not contribute anything to the form data set. A text box always
contributes at least the string consisting of its name and the equals sign.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
Navigation:
[Reply to this message]
|