[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgi-list
Subject:    Re: [CGI] Null <option> values passed by MSIE
From:       JohnBeaman <JRBeaman () w3f ! com>
Date:       1998-12-11 18:16:55
[Download RAW message or body]

MST wrote:
> 
>      Hi there folks. I just found a very weird thing.
> 
>      I have an HTML form that contains fields that look like this:
> 
>         <select name="name">
>         <option value="not provided">
>         <option value="one">One
>         <option value="two">Two
>         ...
>         </select>
> 
>      When I submit the form data to my CGI from Netscape, all is well. When
>      $q->param('name') eq "not provided" the program returns the string
>      "not provided".
> 
>      But MSIE, for some reason, ignores the option value altogether and the
>      CGI is passed a null value, so the CGI returns nothing... and so I am
>      losing data.
> 
>      Does anybody know why MSIE is behaving this way and what I can do,
>      short of HTTP_ENV browser testing, to get around this?
> 
>      Thanks,
> 
>      Meredith Tcherniavsky

An Alternative:

HTML:

<select name="name">
<option>
<option>One
<option>Two
...

PERL:

$name=$FORM{'name'};
$name = "not provided" if ($name eq "");
$name=lc($name);
...

Gets you the same thing in both IE and Netscape,
and (I think) what you want.

-John
-----------------------------------------------------------------
To unsubscribe, send mail to "majordomo@jann.com" with "unsubscribe cgi-list"
in the body.

The CGI Tips & Tricks website (and archive of the list) is located
at http://www.jann.com/Perl/

cgi-list is hosted by Summit Communication Design (http://www.summitdesign.net).

Summit Communication Design is a full-service web hosting firm
providing web design, cgi programming and inter/intra-net support.
-----------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic