Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

why when I use html::form $input->name work,$input->value doesn't work ?

by fanasy (Sexton)
on Nov 14, 2010 at 03:48 UTC ( [id://871272]=perlquestion: print w/replies, xml ) Need Help??

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

follow context is html input
<input type="checkbox" id="chkboxProid4" value="45978663" name="rproid[]" v="1" onclick="selected('apf_id_15','chkboxProid4','myxxxxx1')" />
use diagnostics; use WWW::Mechanize; use Data::Dumper; use HTML::Form; use Encode; use WWW::Mechanize::Plugin::Display; my $name = Encode::decode('GB2312', '&#21047; &#26032;'); my $CACTIURL = "xxxxxxxxxxxxx"; my $ADMINPASSWORD = "zhiyuan"; my $mech = WWW::Mechanize->new(); $mech->get($CACTIURL); $mech->set_visible("xxxxxx", $ADMINPASSWORD); $mech->click; my $link_m = $mech->find_link(url_regex => qr/W0QQactZsale/); my $value_hash =$link_m->url(); $mech->get($link_m); $mech->form_number(2); my @inputs = $mech->current_form()->inputs(); #print "inputs: @inputs\n"; foreach my $input2 (@inputs) { my $input_type= $input2->type; my $input_id= $input2->id; my $input_value= $input2->value; my $input_name= $input2->name; if ($input_type eq "checkbox") { print "LOG: input_name $input_name\n"; print "LOG: input_id $input_id\n"; print "LOG: input_value $input_value\n"; #$mech->field($input2=>'on'); $mech->tick($input2->name,$input2->value); } } $mech->display; foreach my $input3 (@inputs) { my $input_value =$input3->id; #print "LOG:input_value $input_value\n"; if($input_value eq "fresh0"){ #print "LOG:input3 $input3\n"; $mech->click_button(input=>$input3); } }
sorry, please help me on my question is " why the module html::form $input->name work,$input->value doesn't work" under the html context:
<input type="checkbox" id="chkboxProid4" value="45978663" name="rproid[]" v="1" onclick="selected('apf_id_15','chkboxProid4','myxxxxx1')" />
  • Comment on why when I use html::form $input->name work,$input->value doesn't work ?
  • Download Code

Replies are listed 'Best First'.
Re: when use html::form $input->name work,$input->value doesn't work
by Tanktalus (Canon) on Nov 14, 2010 at 05:28 UTC
Re: why when I use html::form $input->name work,$input->value doesn't work ?
by Anonymous Monk on Nov 14, 2010 at 06:05 UTC
    why the module html::form $input->name work,$input->value doesn't work"

    Well, for starters, there is no such variable $input anywhere in your code

      Thanks for your replay the input is :
      my $CACTIURL = "http://www.xxx.com"; $mech->get($CACTIURL); $mech->set_visible("xxxxxx", $ADMINPASSWORD); $mech->click; my @inputs = $mech->current_form()->inputs(); foreach my $input2 (@inputs) { my $input_type= $input2->type; my $input_id= $input2->id; my $input_value= $input2->value; my $input_name= $input2->name;

        In what sense does it "not work"?

        Does your script crash? Does it return the wrong values?

        Note that WWW::Mechanize does not understand Javascript and the HTML input has an onclick attribute, which usually is connected to Javascript.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://871272]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-26 08:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found