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

HTML::Form - turning on a checkbox

From:
steve borruso
Date:
August 25, 2001 22:24
Subject:
HTML::Form - turning on a checkbox
Message ID:
000201c12dec$fd1491c0$6501a8c0@stny.rr.com
Greetings,

Now that I know how to test if a checkbox is "on/off" (thanks Gisle :-) ...
I'm having trouble turning one on.

The test in the code below, after trying to turn one on, fails.

A dump of the form shows the same value for the checkbox both
before and after attempting to turn it on ..

testcheckbox= (checkbox) [*|YES ]

Any assistance is appreciated.
Steve


 @forms = HTML::Form->parse($html,'http://myurl.com');
  print $forms[2] ->dump ;

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

 for($i=1; $i < $#input + 1; $i += 1) {

    $name =  $input[$i]->name();

    if (defined $input[$i]->value)   {
        print "<br> it is on";
      }
      else {
         if ($type eq 'checkbox') {
            print "<br> turning it on <br>";
            $forms[2]->value($name,defined);
            if (defined $input[$i]->value)   {
               print "<br> STATE SHOULD NOW BE CHECKED (ON)";
            }
         }
      }
   }
  print $forms[2] ->dump ;






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