bobdole has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to set the value of a form option that looks like this
<SELECT NAME=office MULTIPLE SIZE=3 > <OPTION SELECTED></OPTION> <OPTION Value='0' >Not Used <OPTION Value='1' >Dallas <OPTION Value='2' >Houston </SELECT>

I am trying to set the value to 1 for Dallas like this
$mech->select( "office","1");
and I am getting the error "Illegal value '1' for field 'office' at ......."

here is the form dump
office= (option) [<UNDEF>/off|*]
office=<UNDEF> (option) [*<UNDEF>/off|0/Not Used]
office=<UNDEF> (option) [*<UNDEF>/off|1/Dallas]
office=<UNDEF> (option) [*<UNDEF>/off|2/Houston]
...
...

Is there a way to set the value of "office" regardless of what it thinks is a valid value?

Replies are listed 'Best First'.
Re: invalid option value with Mechanize
by bobdole (Beadle) on Dec 12, 2007 at 19:24 UTC
    Think I found the issue, because it is a multiple select if I send it an array it seems to work fine
    $mech->select("office", ["1"]);