"steve borruso" <[EMAIL PROTECTED]> writes: > I based my attempts of turning on a checkbox > on the following append which indicates > $f->value(name => undef); would turn the input "OFF". > > http://www.ics.uci.edu/pub/websoft/libwww-perl/archive/2000h2/0485.html > > When I attempt to turn the input "ON" with > $f->value($name,defined); the state does not change. No error > is given when executed. It doesn't seem to matter what I use in > place of "defined". It doesn't appear that I'm changing the > value of the input (as opposed to the state) with what I use either. $f->value($name,defined) means that you evaluate defined($_) and pass this boolean result as the value to set for field. This does not make sense in this context. It ought to croak for a checkbox though. > Can someone please take a look at the code sample below > and point out the logic error and/or provide another example that > might help. > > boiled down sample of my code .... > > @forms = HTML::Form->parse($html,'http://myurl.com'); > > @all_input = $forms[2] -> inputs; > > for($i=1; $i < $#all_input + 1; $i += 1) { use 'for (@all_input) {' instead. > $type= $all_input[$i]->type; > $value = $all_input[$i]->value(); why initialize these variables if you are not going to use them? > $name = $all_input[$i]->name(); > > if (defined $all_input[$i]->value) { > print "<br> it is on"; > } > else { > print "<br> turning it on <br>"; > $forms[2]->value($name,defined); You need to know what value to set. The possible_values() method tell you what values can be used. The 'defined' here is certainly bogus. > if (defined $all_input[$i]->value) { > print "<br> STATE SHOULD NOW BE CHECKED (ON)"; > } > } > } >