how to get select label?

Mike Meyer mwm at mired.org
Thu Dec 15 04:06:39 CET 2005


Dan M <dan at wolf.com> writes:
> On Wed, 14 Dec 2005 13:56:24 -0800, lli wrote:
>> I build web application. So I use CGI. I need to show select text in
>> the html page. Now I can only display select value such as '001'. But I
>> need to display its text 'AAA'.
> I'm a Python newbie, so by all means verify this answer with more
> experienced folks. But what you're running into is a limitation of
> HTML/HTTP/CGI. When your form contains a <SELECT> element, the values that
> get passed to the CGI are the VALUE elements. If you want to get, for
> example, AAA then you would need to put AAA in the VALUE field.

If you leave the VALUE attribute, you'll get the contents of the
OPTION element. This saves having to duplicate the value.

       <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list