Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

problem with form_id

by rashichauhan (Novice)
on Sep 21, 2013 at 06:28 UTC ( #1055108=perlquestion: print w/ replies, xml ) Need Help??
rashichauhan has asked for the wisdom of the Perl Monks concerning the following question:

In web page http://metexplore.toulouse.inra.fr/metexplore/index.php/2011-06-06-14-41- 10/choke-point-reactions there exist a form with form id="form" but no name and no number. So i have used form_id function of mechanize module <form id="form" action="printChokePoints.php" method="POST" enctype="multipart/form-data">
my $name1="form"; $mech->form_id($name1);
But the error is coming "There is no form with id "form".Why this error is coming.Plz help me.

Comment on problem with form_id
Download Code
Re: problem with form_id
by Corion (Pope) on Sep 21, 2013 at 07:50 UTC

    You will have to learn about HTTP and HTML, and how the two interact. The URL you linked contains frames. Until you learn about frames, what they mean for HTTP and HTML, and how WWW::Mechanize treats them, you will encounter the same problem over and over.

    I recommend that you start out by printing the content of what WWW::Mechanize sees as the current page:

    print $mech->content

    After you've seen the content and understood what the content means (which is a HTML question outside of the scope of this website), you will understand the steps necessary to get to the correct page.

Re: problem with form_id
by Old_Gray_Bear (Bishop) on Sep 21, 2013 at 07:58 UTC
    Once I corrected the typo in your URL and got to the metexplore page, I looked at the HTML source. You are getting the error because there is no form-id element, named or otherwise in the code.

    Now, I may be missing something (it has been a while since I needed to swat through HTML with a Mark I Eyeball), but it appears that the error you are getting is valid. Perhaps you were looking at a different page on the site?

    ----
    I Go Back to Sleep, Now.

    OGB

      Yess..When you saw HTML page source...no form is visible...but when I go to that select box in that page..and see the frame source of Select box form is present whose id is "form".
Re: problem with form_id
by sundialsvc4 (Monsignor) on Sep 21, 2013 at 14:43 UTC

    To add a wee bit of big-picture to the comments here ... if you looked (say, with the Firebug debugger, or most browsers in “Developer” mode) at the HTML-source of any page at all which contains a <frame>, you would see the tag ... but nothing of what the tag refers to.   This is because it’s not there:   frames are separately-fetched.   They are very much like “pages within pages,” because the browser initiates a separate HTML turn-around to get them, and more-or-less manages them in isolation from the “host” page.   And, basically, that’s what your script has to do, too:   it must find the frame-references, determine what they call for, and then fetch what they call for.   (As the FAQ somewhat tersely explains.)

Re: problem with form_id
by tangent (Deacon) on Sep 21, 2013 at 15:28 UTC
    Looking at the source of the URL you give I note that the form is contained within the frame at this url
    http://metexplore.toulouse.inra.fr/metexploreJoomla/metexplore/computa +tional/choke/chokePoints.php?a=a
    Use that URL and you can then access the form (tested!)
      Thank you...so much...It is now working...thanx a lot!!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2014-08-27 18:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (248 votes), past polls