Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Does anyone know if hidden fields have to be filled in or does the form use them automatically with the module?

If you're selecting a form and then submitting it, hidden fields are sent, HTML::Form makes sure of that

Every time I have a question like this, I write a program

#!/usr/bin/perl -- use strict; use warnings; use WWW::Mechanize; use URI::file; my $ua = WWW::Mechanize->new(); $ua->timeout( 0.1 ); $ua->get( URI::file->new( __FILE__ ) ); $ua->add_handler("request_send", sub { shift->dump; return }); $ua->add_handler("response_done", sub { shift->dump; return }); $ua->form_number(0); $ua->submit; #~ <form action="http://127.0.0.1:666666/" enctype="multipart/form-dat +a" method="post"> #~ <input name="HIDER" value="REDIH" type="hidden"> #~ <input type="button" name="button1" value="click1" /> #~ <input TYPE="checkbox" VALUE=3 NAME="foo" CHECKED> #~ <input type="text" name="hi"> #~ <input type="submit" name=".submit" /> #~ </form> __END__ POST http://127.0.0.1:666666/ Accept-Encoding: gzip Referer: file:///D:/dev/misc/mechanize.hidden.pl User-Agent: WWW-Mechanize/1.66 Content-Length: 189 Content-Type: multipart/form-data; boundary=xYzZY --xYzZY\r Content-Disposition: form-data; name="HIDER"\r \r REDIH\r --xYzZY\r Content-Disposition: form-data; name="foo"\r \r 3\r --xYzZY\r Content-Disposition: form-data; name="hi"\r \r \r --xYzZY--\r\n 500 Can't connect to 127.0.0.1:666666 (timeout) Content-Type: text/plain Client-Date: Sat, 19 Mar 2011 03:08:12 GMT Client-Warning: Internal response Can't connect to 127.0.0.1:666666 (timeout)\n LWP::Protocol::http::Socket: connect: timeout at C:/perl/site/5.12.2/l +ib/LWP/Protocol/http.pm line 51.\n Error POSTing http://127.0.0.1:666666/: Can't connect to 127.0.0.1:666 +666 (timeout) at D:\dev\misc\mechanize.hidden.pl line 24

In reply to Re: WWW::Mechanize's affect on hidden fields by Anonymous Monk
in thread WWW::Mechanize's affect on hidden fields by sulfericacid

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-19 19:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found