Mur has asked for the wisdom of the Perl Monks concerning the following question:
There doesn't seem to be a straightforward approach to setting both fields at the same time.<select id="birth_month" name="birthdate"> <option value=""> -- </option> <option value="01"> Jan </option> ... </select> <select id="birth_day" name="birthdate"> <option value="01"> 01 </option> ... </select>
Both of these set only a single value.$mech = Test::WWW::Mechanize->new(); ... $mech->submit_form( with_fields => { ..., 'birthdate' => ['01',0] }); # or $mech->set_fields({ ..., 'birthdate' => ['01',0] });
and the first setting is lost (overwritten by the second). I also tried HTTP::Recorder as a proxy to see what would be submitted, but it just uses the last approach (multiple calls to 'field' without apparent success). Yes, I could alter the form to avoid this, but there's a fair amount of work downstream if I do. I just want to send two values through the form under one CGI parameter, just as the real form does in the browser.$mech->field('birthdate', ['01'], 0); $mech->field('birthdate', ['17'], 1);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Duplicate field names and Test::WWW::Mechanize
by roboticus (Chancellor) on Aug 14, 2007 at 14:48 UTC | |
|
Re: Duplicate field names and Test::WWW::Mechanize
by ww (Archbishop) on Aug 14, 2007 at 19:40 UTC | |
|
Re: Duplicate field names and Test::WWW::Mechanize
by serf (Chaplain) on Aug 15, 2007 at 08:42 UTC |