Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: building combo box

by davis (Vicar)
on Sep 17, 2006 at 10:03 UTC ( #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.


Comment on Re: building combo box
Download Code
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
Re^2: building combo box
by Fletch (Chancellor) 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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-07-25 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (169 votes), past polls