[mod_python] Accessing all form fields, empty strings or not

Michael S. Fischer michael at dynamine.net
Fri May 21 11:30:52 EDT 2004


Edward Diener writes:

> That is very strange because when I check the keys for my form (
> form.keys() ), the checkbox field only exists in the list of 
> keys when the checkbox is checked but doesn't exist 
> otherwise. But I do see the code mentioned above in psp.py. 
> Is there any other way to find out if a field exists in a 
> form irregardless whether its value is blank or not ?

You didn't mention that it was a checkbox field before.

Checkbox fields are a special case; many browsers do not include unchecked
checkbox fields when submitting a form to the server (MSIE 6 included).
Therefore, it should not be unsurprising that such empty fields are not in
the list of form keys.

There's nothing you can do about this other than to recognize the situation
and code around it.

Cheers,

--Michael



More information about the Mod_python mailing list