Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

HTML::Form - Can you add new inputs?

by initself (Monk)
on Feb 17, 2007 at 00:56 UTC ( #600562=perlquestion: print w/replies, xml ) Need Help??

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

Due to a very obstinate website, I'm having problems obtaining all of the inputs for a particular web form using WWW::Mechanize. My $mech object only returns two of the inputs whereas there should be 4 returned. You can see all the possible inputs in the source (the form name is "aspnetForm"). Since the other two aren't returning, I'd like to add those missing values to the HTML::Form object and submit them. It doesn't look like the HTML::Form object allows this; it will allow you to modify existing inputs but not add entirely new ones that weren't in the retrieved form.

Here is the link: http://friends.myspace.com/index.cfm?fuseaction=user.viewfriends&friendID=29006405

1) Is there a way to add an input to an HTML::Form object?
2) If not, is there a way to create an HTML::Form object from scratch?

Replies are listed 'Best First'.
Re: HTML::Form - Can you add new inputs?
by initself (Monk) on Feb 17, 2007 at 01:40 UTC
    Solved it. There is an internal method to HTML::Form called push_input. I just had to use it. It should probably be in the docs for HTML::Form, eh?
    my @attr = ( { 'name' => '__EVENTTARGET', 'id' => '__EVENTTARGET', 'value' => 'ctl00$cpMain$pagerTop', }, { 'name' => '__EVENTARGUMENT', 'id' => '__EVENTARGUMENT', 'value' => '2', }, ); for (@attr) { $mech->form_number(0)->push_input('hidden', $_); }
Re: HTML::Form - Can you add new inputs?
by AK108 (Friar) on Feb 17, 2007 at 17:58 UTC

      This is precisely the kind of useful help from other monks that prompted me to write "Perl Monks += TMTOWTDI"..

Re: HTML::Form - Can you add new inputs?
by EvanCarroll (Chaplain) on Aug 21, 2008 at 20:33 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://600562]
Approved by chargrill
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2021-01-26 12:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?