[EMAIL PROTECTED] writes:

> The value can be defined with the box not being checked; it's two separate
> properties.  So making the value undef won't uncheck the box, it will just
> make a useless checkbox in the sense that even if it's checked nothing
> gets sent to the server.  If it's checked then the value gets sent to the
> server.
> 
> Have you tried it using the checked attribute instead of value?

If you are talking of about an input object as found in HTML::Form
then this is wrong.  There is no 'checked' attribute.  A checkbox is
effectively checked if the 'value' is assigned and unchecked if the
value is 'undef'.

The confusing part is that the value attribute in the HTML does not
directly correspond to the value attribute of the HTML::Form input.

This HTML:  <checkbox name="foo" value="bar">
Results in this input object:

   $input->type:            'checkbox'
   $input->name:            'foo'
   $input->value:           undef
   $input->possible_values: (undef, 'bar')

This HTML:  <checkbox name="foo" value="bar" checked>
Results in this input object:

   $input->type:            'checkbox'
   $input->name:            'foo'
   $input->value:           'bar'
   $input->possible_values: (undef, 'bar')

In both cases you can set the value to undef to effectively uncheck it
and 'bar' to check it.

Regards,
Gisle

Reply via email to