Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: Help with javascript navigation

by bauer1sc (Initiate)
on Jul 16, 2007 at 19:05 UTC ( [id://626903]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Help with javascript navigation
in thread Help with javascript navigation

After trying this I get the error of Input '__EVENTTARGET' is readonly at C:/perl/site/lib/WWW/Mechanize.pm line 1351 Is that just plainly indicating that the value cant be manually set?

Replies are listed 'Best First'.
Re^5: Help with javascript navigation
by almut (Canon) on Jul 16, 2007 at 20:14 UTC

    Are you sure it's an error, not just a warning?   __EVENTTARGET presumably is a hidden field, which, according to HTML::Form, starts out readonly:

    $bool = $input->readonly
    $input->readonly( $bool )
    This method is used to get/set the value of the readonly attribute. You are allowed to modify the value of readonly inputs, but setting the value will generate some noise when warnings are enabled. Hidden fields always start out readonly.
      Ive tried setting the __EVENTTARGET and am still getting the warning. I have changed the link number to vary the results with no luck. Here is my code
      use strict; use WWW::Mechanize; use Time::Local; use POSIX 'strftime'; use HTML::Strip; my($url) = 'http://www.usgbc.org/LEED/Project/RegisteredProjectList.as +px?CMSPageID=243&CategoryID=19&'; my($pageCheck) = ""; my $mech = WWW::Mechanize->new(autocheck =>1); my($dirname) = "C:\\Program Files\\Perl Express\\Scripts\\"; my($fname) = "output.txt"; my($x) = 0; open(OUT , ">$dirname$fname") || die "Cant open file"; #initialization to strip HTML from document my $hs = HTML::Strip->new(); $mech->agent_alias('Linux Mozilla'); $mech->get($url) or die "Page $url can't be reached"; print "Made it past the url test\n"; my($form) = $mech->forms(); #selects all options from the lstLeedRating Field my $menu = $form->find_input("lstLeedRating"); #clicks the BtnSearch $pageCheck = $mech->click_button(name => "btnSearch"); my $pageCheck2 = ""; $pageCheck2 = $mech -> submit_form( with_fields => { '__EVENTTARGET' => 'dgRegProjectList:_ctl29:_ctl7', }, ); if($pageCheck2->is_success){ print $pageCheck2->content; #print $pageCheck->content; } else { print STDERR $pageCheck2->status_line, "\n"; die "Page with those fields not found!"; } my $page = $mech->content; my $clean_text = $hs->parse( $page ); $hs->eof; $clean_text =~s/.*(multiple LEED Rating Systems)//s; my @lines = split /\n/, $clean_text; for (@lines){ s/^\s+//; s/\s+$//; s/\s+/ /g; } $clean_text =~s/(2  3  4).*//s; my @lines2 = split /\n/, $clean_text; for (@lines2){ s/^\s+//; s/\s+$//; s/\s+/ /g; } my $clean = join "\n", @lines2; print OUT $clean; close OUT;
      I have a feeling it has somethign to do with there call to the __doPostBack
      <script language="javascript" type="text/javascript"> <!-- function __doPostBack(eventTarget, eventArgument) { var theform; if (window.navigator.appName.toLowerCase().indexOf("microsoft" +) > -1) { theform = document.frmRegisteredProjectList; } else { theform = document.forms["frmRegisteredProjectList"]; } theform.__EVENTTARGET.value = eventTarget.split("$").join(":") +; theform.__EVENTARGUMENT.value = eventArgument; theform.submit(); } // --> </script>
      Let me know what you think, and thanks in advance!

        I have a feeling it has somethign to do with youre not reading neither almut's reply nor HTML::Form. At least, I see no trace of either in the code you posted now. So, how about telling us where/how you incorporated almut's reply into your code?

        Let me know what you think, and thanks in advance!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-29 08:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found