empty form fields

Cliff Crawford cjc26 at nospam.cornell.edu
Tue Sep 25 09:31:00 EDT 2001


* Nihat Ciddi <nikinakof at gmx.net> menulis:
| 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 ?

You can check for empty fields with has_key():

    if form.has_key("name"):
        name = form["name"].value
    else:
        print "Error: name missing"
    # etc.


-- 
Cliff Crawford                  ::                cjc26 at cornell dot edu
"Along the way of life, someone must have sense enough and morality enough
to cut off the chain of hate. This can only be done by projecting the ethic
of love to the center of our lives." -- Martin Luther King, Jr.



More information about the Python-list mailing list