On May 26, 2005, at 11:22 AM, Alex Brelsfoard wrote:

> This is indeed the case.

If browsers reliably submitted form fields in the same order they  
were listed in the HTML source, then you could double up with a  
hidden form field like

<form method="get">
<input type="hidden" name="sign_me_up" value="0">
<input type="checkbox" name="sign_me_up">
<input type="submit" value="Go">
</form>

and then receive either

form.html?sign_me_up=0

or

form.html?sign_me_up=0&sign_me_up=on

and have the second value clobber the first, but I've heard they  
don't. Also, CGI.pm would treat it as a multiple select and even  
parsing it yourself would get confusing if any multiple selects  
actually were tacked on.

The browser is supposed to submit a supplied checkbox 'value' if  
checked. So you could create a special value like 'rutabaga' or  
'4kj5h245kjh245' that is extremely unlikely to appear in any other  
input type, and process fields with this value so that the field is  
considered true whether the hidden field with the zero comes before  
or after it.

<form method="get">
<input type="hidden" name="sign_me_up" value="0">
<input type="checkbox" name="sign_me_up" value="4kj5h245kjh245">
<input type="submit" value="Go">
</form>

Bogart

 
_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to