Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Submitting a second form

by daxim (Chaplain)
on Jul 21, 2013 at 13:44 UTC ( #1045508=note: print w/ replies, xml ) Need Help??


in reply to Submitting a second form

Counting forms is not necessary when the forms have unique characteristics, which in practice they always have.

$mech->submit_form( with_fields => { modem => '1122.3344.5566', ip_select => '1.2.3.4', } );


Comment on Re: Submitting a second form
Download Code
Re^2: Submitting a second form
by rp132 (Initiate) on Jul 21, 2013 at 16:37 UTC

    I tried the example you gave and thought that it may work, but I get the error "There is no form with the requested fields".

      Hello, I would recommend getting the firefox add-on Firebug, inspect the page for the form's name in the HTML, and add it that way. for example:
      $mech->submit_form ( form_name => 'form', fields => { modem => '1122.3344.5566', ip_select => '1.2.3.4'} );
      In fact, looking at your code again to give you that example, problems may have been caused by not separating the field names with a comma? But I'm not sure.. see if that works for you, though..
      Actually, it's not an error. There is no form with the requested fields. Is the url correct? Any syntax problems? Try this:
      #!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; my $url = 'http://www.example.com/cgi-bin/testcode.tcl'; my $mech = WWW::Mechanize->new( autocheck => 1 ); $mech->get($url); my(%fields) = ( modem => '1122.3344.5566', ip_select => '1.2.3.4', ); my $result = $mech->submit_form( with_fields => %fields, ); print $result;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045508]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (14)
As of 2014-08-27 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (253 votes), past polls