Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Set default in scrolling list

by chipmunk (Parson)
on Jan 09, 2002 at 20:50 UTC ( #137488=note: print w/replies, xml ) Need Help??

in reply to Set default in scrolling list

Works fine for me. Note that, since CGI's form fields are sticky, you don't even need to set the default value. It will just pick up the current value(s) for the 'country' parameter anyway.

If you really want to change the a form field's initial values, the docs for CGI explain how:

Another note The default values that you specify for the forms are only used the first time the script is invoked (when there is no query string). On subsequent invocations of the script (when there is a query string), the former values are used even if they are blank. If you want to change the value of a field from its previous value, you have two choices: (1) call the param() method to set it. (2) use the -override (alias -force) parameter (a new feature in version 2.15). This forces the default value to be used, regardless of the previous value: print $query->textfield(-name=>'field_name', -default=>'starting value', -override=>1, -size=>50, -maxlength=>80);

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2020-01-20 08:24 GMT
Find Nodes?
    Voting Booth?