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

HTML::Form - turning on a checkbox

steve borruso
August 25, 2001 22:24
HTML::Form - turning on a checkbox
Message ID:

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.

 @forms = HTML::Form->parse($html,'');
  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>";
            if (defined $input[$i]->value)   {
               print "<br> STATE SHOULD NOW BE CHECKED (ON)";
  print $forms[2] ->dump ; Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About