http://www.perlmonks.org?node_id=692634

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

hi,

how can i submit a nameless form using WWW:Mechanize or in any other way?

-opensourcer
  • Comment on submitting nameless form using WWW::mechanize

Replies are listed 'Best First'.
Re: submitting nameless form using WWW::mechanize
by Corion (Patriarch) on Jun 18, 2008 at 06:49 UTC

    Submit it by number instead, like the synopsis of WWW::Mechanize shows:

    $mech->submit_form( form_number => 3, fields => { username => 'mungo', password => 'lost-and-alone', } );
      it's a nameless form <form> .... </form>
      i have checked for form number using $mech->forms()
      which displays nothing .
        "i have checked for form number using $mech->forms() which displays nothing."

        This might be due to JavaScript generated forms, which are really a pain in the ***. Try to look at the source through your preferred webbrowser and see what's going on there. If the form is there, without a name, indeed simply count them (and don't forget hidden forms ;-)

        --
        b10m

        Every form has a number. You start counting by 1 and increment the form number whenever a new form starts. Just try it:

        $mech->form_number(3); # selects the third form on the page $mech->submit; # submits the third form
        Count, you know 1, 2, 3, 4, 5 , 6, 7, 8, 9, 10, them select the form 3rd form on the page