> -----Original Message-----
> From: Gerry Jones [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 01, 2001 5:11 AM
> To: CGI Beginners
> Subject: Re: CGI.pm popup_menu
> 
> 
> On Thursday 01 November 2001 02:06, you wrote:
> > I am attempting to use the DEFAULT parameter within a 
> popup_menu to set the
> > displayed value to what I want based on the passed 
> parameters in the URL.
> > I am using Mozilla 0.9.4 on a Linux machine, and hope that 
> isn't the reason
> > I'm not seing what I want to see.  Here is the code:
> >
> > ----CODE----
> > #!/usr/bin/perl -w
> >
> > use CGI qw(:standard);
> >
> > print header, start_html("cgi_pm_test.cgi");
> > print popup_menu(
> >              -NAME => "baths",
> >              -VALUES => ["0", "1", "1 1/2", "2"],
> >              -LABELS => {
> >                          0 => "?????",
> >                          1 => "1",
> >                          "1 1/2" => "1 1/2",
> >                          2 => "2",
> >              }
> >              -DEFAULT => 1,
> > );
> > print end_html;
> > ----END CODE----
> > Any thoughts out there?  Thanx.
> 
> I'm no pro, but I was just doing what you want the other day, 
> so here goes...
> 
> You shouldn't use quotes - instead use apostrophe's, there is 
> probably a 
> reason why, but I can't remember.

That's because there is no reason. The double quotes are fine,
and are not related to the problem in any way.

> Also, you can't use a 
> -LABELS part. Read 
> the CGI.pm docs to see what you can use with functions. 

Sure you can. Either you need to read the docs, or you need to
upgrade your CGI module.

> Your code should look like this:
>
> ...
> print popup_menu(
>               -name=>'baths',
>               -value=>['0', '1', '1 1/2', '2']
>               -default=>'1'
> );

Only if he dosen't want it to work. Did you actually run this?
If you did, you would have seen the warning, since you had the
-w flag set. You make the same mistake the original poster did: 
omitting the comma before "-default". 

Here's the output I got when I ran that code:

   <select name="baths" 1>
   <option  value="1073866360">1073866360</option>
   </select>

Hey, everybody makes mistakes. But take the time to actually
run the code you post.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to