"Ajar" <[EMAIL PROTECTED]> writes:
> Is there any way to retrieve the type(checkbox,radio...) of the form
> field from cgi.FieldStorage. I tried something like form['name'].type,
> but this field seems to be None for all the form fields

There isn't. cgi.FieldStorage parses data sent via an HTTP
request. The type of the input element isn't part of the data sent in
an HTTP request. So not only is there no way to get it from
cgi.FieldStorage, there's no way to get it from any HTTP handling
facility, unless it gets stored somewhere outside the element in
question for you to retrieve.

While you do have to store it outside the element, you don't have to
store it outside the form. You could create a series of hidden input
elements with names "foo.type" whose value was the type of the element
foo.  If your pages are dynamically generated, you could create a
dictionary mapping element names -> types, and then pickle that and
store the results in a hidden element. Or - well, I'm sure you get the
idea.

        <mike
-- 
Mike Meyer <[EMAIL PROTECTED]>                  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to