empty form fields
Sam Penrose
sam at ddmweb.com
Tue Sep 25 15:18:05 EDT 2001
>> how can i control empty form fields in a html form. i tried the code
below; but it is not working. example, what can i do ?<<
Instantiating this way:
form = cgi.FieldStorage(keep_blank_values=1)
will in my experience preserve the contents of text boxes, but I don't
count on it for every widget as interpreted by every browser. As Cliff
notes (no pun intended), you want to use the has_key method.
The cgi.FieldStorage can get you up and running very quickly, but it has
some infelicities. If you spend much time using it, I would recommend
looking at one of the many Python web-app frameworks. Webware
<http://webware.sourceforge.net/> and Quixote
<http://www.mems-exchange.org/software/quixote/> are both notable for
having lightweight wrappers for cgi.FieldStorage that address some of
its issues.
More information about the Python-list
mailing list