I am trying to manipulate the form at this link

The code uses JS to populate the options for the next element based on the current element. While I have been able to select the element for district I am not able to trigger the script to load the next element. Any pointers on what I am doing wrong.

use strict; use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new(); $mech->get('http://117.247.176.82/VIEWDOCS.aspx'); $mech->autoclose_tab( 0 ); $mech->allow( javascript => 1 ); my @el = $mech->by_id('MainContent_ddldist'); $el[0]->__event('mousedown'); $mech->select( 'ctl00$MainContent$ddldist'=>'BN'); $el[0]->__event('mouseup'); #Well the mouse event did not work, lets trigger on change directly. $el[0]->__event('onChange'); my @el=$mech->by_id('ctl01'); $el[0]->__event('click'); #even this did not work and I have spent over a day on this... time to + seek the wisdom of the monks?. sleep 10

In reply to WWW::Mechanize::Firefox trigger onchange event by vijayvithal

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.