[Chicago-talk] www::mechanize - setting a drop down list

Ed Summers ehs at pobox.com
Sun Nov 2 07:38:05 CST 2003

On Sat, Nov 01, 2003 at 06:27:34PM -0600, Jay Strauss wrote:
>   <SELECT NAME="TIME_PERIOD" onChange="selectTimePeriod()" SIZE="1"
> STYLE="font-size: xx-small; font-family: Arial,Helvetica;">
>       <OPTION VALUE="0" SELECTED>Last 7 Days</OPTION>
>       <OPTION VALUE="1" >Last 14 Days</OPTION>
>       <OPTION VALUE="2" >Last 30 Days</OPTION>
>       <OPTION VALUE="3" >Last 60 Days</OPTION>
>       <OPTION VALUE="4" >Last 6 Months</OPTION>
>       <OPTION VALUE="5" >Current Year</OPTION>
>       <OPTION VALUE="6" >Prior Year</OPTION>
>   </SELECT>

It looks like there is some JavaScript being called as a result of the 
onChange attribute on the SELECT tag. Most likely it is doing some
sort of client side form verification before it submits the form.

Last I heard there is some rudimentary support for JavaScript in 
WWW::Mechanize, but nothing that would handle this function selectTimePeriod().
You could look at the JavaScript code, figure out what it is doing, and change 
your WWW::Mechanize bot behavior as appropriate. Perhaps it is mapping the 
value's to a new value, or doing some other kind of voodoo? If you post the
whole page I would be willing to take a look.

A couple other things to double check:

- is the form name really "DATERANGE"?

- is there a special button that the user is supposed to click, like a
  "search" button or something? If so, you'll have to specify the button
  to click with the 'button' parameter in your call to submit_form().

Good luck!


More information about the Chicago-talk mailing list