Google Answers Logo
View Question
 
Q: Perl HTML:Form ? How do I call the click method and avoid javascript alerts? ( No Answer,   4 Comments )
Question  
Subject: Perl HTML:Form ? How do I call the click method and avoid javascript alerts?
Category: Computers > Programming
Asked by: guysmiley-ga
List Price: $10.00
Posted: 02 May 2002 13:59 PDT
Expires: 02 May 2002 19:11 PDT
Question ID: 11162
Using Perl's HTML::Form module, I am trying to change a hidden value
in a form before the form is posted. Here's a slice of code that I'm
using.
 
  my $apclick = $form->find_input('click'); 
  my $apsearch = $form->find_input($search); 
  my $aptitle = $form->find_input($title); 
  my $apdesc = $form->find_input($desc); 
  my $apurl = $form->find_input($url); 
    
  $form->value( $apclick, 'true');   # this line returns error 
  $form->value( $apsearch, $u_term ); 
  $form->value( $aptitle, $u_title ); 
  $form->value( $apdesc, $u_desc ); 
  $form->value( $apurl, $u_url ); 
  $form->value( $apbid, $u_bid ); 
 
The code works for setting the values on the other fields but bombs
when trying to set the value of the hidden field. The error message
returned is:
 
No such field 'HTML::Form::TextInput=HASH(0x85d5f04)' at ./so.pl line
378
 
================ 
 
The reason I'm trying to post to the hidden field is because I'm
populating a form and then calling ->click and getting a response of
is_succes is true. If I manually try to enter the same data in the
form when I click on the submit button I get a javascript alert that
after clicking OK sets the hidden value of the form to 'true' so that
when I click the submit button again I don't get the alert.
 
Since I can NOT change hidden form values how do I get around this
annoying javascript alert? Any suggestions would be greatly
appreciated.
 
Thanks so much, 
 
Guy Davis 

Request for Question Clarification by joey-ga on 02 May 2002 14:03 PDT
When you've set up your hidden field in your HTML, have you
prepopulated it with a value?
 
e.g. does your HTML code say <input type="hidden" name="whatever"
value="something"> or is the value element missing or blank?
 
--Joey 

Clarification of Question by guysmiley-ga on 02 May 2002 14:10 PDT
I'm not setting up the form. I'm navigating a site on the web trying
to submit postings in an automated fashion. The form is already set up
with the value for the hidden input field 'click' to 'false'. 

Clarification of Question by guysmiley-ga on 02 May 2002 14:13 PDT
I'm wondering if there's some kind of setting I can change for the
HTTP::Request class to avoid any kind of scripting.
 
Unfortunately according to the Perl online docs it looks like it is
not possible to change the value of a hidden input form element. 
Answer  
There is no answer at this time.

Comments  
Subject: Re: Perl HTML:Form ? How do I call the click method and avoid javascript alerts?
From: lexi-ga on 02 May 2002 15:01 PDT
 
Is there some reason the form element needs to be hidden? Servers
generally do not distinguish between the two types of fields, so if
you can convince perl to treat it as a non-hidden field you should be
okay. It seems like you could build a new form that contains all the
same elements but does not mark any of them hidden.
Subject: Re: Perl HTML:Form ? How do I call the click method and avoid javascript alerts?
From: guysmiley-ga on 02 May 2002 15:20 PDT
 
I'm looking into doing just that by looping through the fields using
$form->inputs placed into a hash and using the HTTP::Request::Common
with a Post the url and the hash.

I should know if it's going to work shortly.
Subject: Re: Perl HTML:Form ? How do I call the click method and avoid javascript alerts?
From: guysmiley-ga on 02 May 2002 15:40 PDT
 
I'm looking into doing just that by looping through the fields using
$form->inputs placed into a hash and using the HTTP::Request::Common
with a Post the url and the hash.

I should know if it's going to work shortly.
Subject: Re: Perl HTML:Form ? How do I call the click method and avoid javascript alerts?
From: webadept-ga on 02 May 2002 17:34 PDT
 
JavaScript runs in the browser, where as Perl is ran on the server and
the output sent to the browser. You could look into using Perlscript
(yes, it exists and can be used in a browser, but many don't support
it) but this would be redundant to using the JavaScript.

I'm afraid you are going to find that the answer to your question is
"you can't" Of course everyday someone is doing something that someone
else said is impossible. A good resource for finding the answer to
this may be at perlmonks.com. There, several hundred Perl gurus will
go over your question and the guy who make HTML::Form hangs out there
as well.

Good luck in your search.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy