Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: building combo box

by davis (Vicar)
on Sep 17, 2006 at 10:03 UTC ( [id://573388]=note: print w/replies, xml ) Need Help??


in reply to building combo box

The bit that's failing is the "for" inside the array ref — that just can't work. Besides, it looks like you might be trying to:
#!/usr/bin/perl use warnings; use strict; use CGI; my $cgi = CGI->new(); print $cgi->popup_menu(-name=>"Days", -values=>[ 1 .. 31]);
Although this isn't the correct way of doing it — you should use one of the DateTime modules to get the number of days in the month (How many days are there in February 2000? February 2004? February 2100?)

davis
Kids, you tried your hardest, and you failed miserably. The lesson is: Never try.

Replies are listed 'Best First'.
Re^2: building combo box
by Fletch (Bishop) on Sep 17, 2006 at 12:11 UTC

    A for inside the array ref won't work, but for future reference a map would work fine (but yes it's unneeded in this case since it's easily made with ..-as-list-constructor).

    my $array = [ map { transmogrify_foo( $_ ) } 1..31 ];
Re^2: building combo box
by jdtoronto (Prior) on Sep 17, 2006 at 13:13 UTC
    davis has given you an appropriate answer, I would like to add that you should refer to the LATEST documenation for a module. The Select method has been deprecated for a long time, as far back as 1998 and at a quick check it doesn't appear in the current CGI documentation. I don't know where you found the information you have based your code on, but it is more than a little out of date.

    You might like to refer to Ovids CGI course, it will guide you along a well founded path.

    jdtoronto

      The Select method has been deprecated for a long time, as far back as 1998 and at a quick check it doesn't appear in the current CGI documentation

      It may be deprecated, but it's there. Look in Non-standard HTML Shortcuts.

Re^2: building combo box
by beginr (Novice) on Sep 17, 2006 at 10:12 UTC
    Thank you your code is working fine for me

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://573388]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-03-19 10:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found