develooper Front page | perl.libwww | Postings from August 2001

HTML::Form checkbox question

Thread Next
From:
steve borruso
Date:
August 24, 2001 16:14
Subject:
HTML::Form checkbox question
Message ID:
000201c12cf0$2116cc80$6501a8c0@stny.rr.com
Greetings,

I've been trying to test a group of checkboxes to see if they are checked or
unchecked.

Having difficulty determining the method to test the condition from reading
the Perldoc,
mailing list archive, etc.

I've been able to get the HTML page, find the form I want and test a few
things about
the checkboxes but need to know how to test if it's checked and then check
it if not.
The value() method returns the text asinged to the control. Not sure how to
test if
the control is "on/off".

Any assistance in appreciated.
Steve Borruso


    $ua = LWP::UserAgent->new;
    $r = $ua->simple_request(POST "http://my_url.com",
                              {
                                 Userid => 'user1',
                                 password => 'pswd1',
                              });
   $html = $r->content;

   @forms = HTML::Form->parse($html,'http://my_url.com');

   @all_input =  $forms[2] -> inputs;

   print "Content-type: text/html\n\n";

   for($i=1; $j < $#all_input + 1; $i += 1) {
      print "<br>";
      print $all_input[$i]->type;
      print "<br>";
      print $all_input[$i]->value();
      print "<br>";
      print $all_input[$i]->name();
   }



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About