Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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 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.

Replies are listed 'Best First'.
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.


      Yess..When you saw HTML page 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 tangent (Vicar) 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 +tional/choke/chokePoints.php?a=a
    Use that URL and you can then access the form (tested!)
      Thank much...It is now working...thanx a lot!!
Re: problem with form_id
by sundialsvc4 (Abbot) 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.)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1055108]
Approved by hdb
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2018-07-21 06:21 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (444 votes). Check out past polls.