In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Alan F Larimer Jr) 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;

#!/usr/bin/perl -w
# mytest.cgi
use strict;
use CGI 2.78 qw/:standard :html3 -no_xhtml/;
use CGI::Pretty qw/:html3/;

my %labels = ( 
    '0'       => '?????',
    '1'       => '1',
    '1 1/2' => '1 1/2',
    '2'       => '2'
);
print header(), start_html("cgi_pm_test.cgi"),
        start_form(),
            popup_menu(-name=>'baths', -Values=>\%labels, -default=>'1'),
            submit(-name=>'submit', -Value=>'Click Me'),
        end_form(),
        end_html;

the following output gets produced:

Content-Type: text/html; charset=ISO-8859-1

<!DOCTYPE html
    PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd";>
<html lang="en-US"><head><title>cgi_pm_test.cgi</title>
</head><body>
<form method="post" action="mytest.cgi" 
enctype="application/x-www-form-urlencoded">
<select name="baths">
<option  value="0">?????</option>
<option selected="1" value="1">1</option>
<option  value="2">2</option>
<option  value="1 1/2">1 1/2</option>
</select><input type="submit" name="submit" value="Click 
Me"></form></body></html>

note the capital V in Value and Values in the script above. 
see cgi_docs.html for details (comes with CGI.pm when you download from 
CPAN)

-- 
Scott R. Godin            | e-mail : [EMAIL PROTECTED]
Laughing Dragon Services  |    web : http://www.webdragon.net/

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

Reply via email to