Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: modifying listbox value?

by dorward (Curate)
on Apr 27, 2009 at 07:01 UTC ( #760286=note: print w/ replies, xml ) Need Help??


in reply to modifying listbox value?

It depends on how you are building the content of the "list box" (by which I assume you mean "An HTML select element").

Assuming you are using the built in methods of the CGI module (not the approach I would use, I'd much rather separate things out with Template-Toolkit), then just pass different data after testing for the condition. The approach is pretty much the same with any other method, it just needs adapting for where you pass the data to.

my $condition = 1; my @options = qw/val1 val2/; if ($condition) { @options = qw/val3 cal4/; } my $q = CGI->new(); print $q->Select( map { $q->option($_) } @options );


Comment on Re: modifying listbox value?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-09-23 10:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (218 votes), past polls