No, the fact that unchecked boxes aren't sent is a browser issue.  It's the 
same reason why submit buttons that are not clicked are undefined as well 
on a multi-submit form.

What you can do, however, is use other form fields in combination with 
logic. For example, let's say the name of your check box is 
"view_all_records" and you want it to explicitly be set on or off.

Well, then you can always create a hidden variable called the same thing 
and set it to off by default...

So

<input type="hidden" name="view_all_records" value="default_off">

And then in CGI.pm, expect $q->param('view_all_records') to return an array 
if the check box is on, and return an array with a single value if the 
check box is off (the single value will be the hidden field).

The technique would be slightly different if you had many check boxes with 
the same name but different value. eg In a WebDB, you might allow selection 
of the id of a record by allowing the user to click next to database rows.

The extrapolation of the above technique to the second I describe with 
multi-checks is left as an exercise to the reader (since it wasn't the 
situation you described anyway).

At 06:08 PM 9/8/2001 -0700, Simon K. Chan wrote:
>Hi Everyone,
>
>Let's say I have this snippet of code for a checkbox:
>
><input type=checkbox name="bill">
>
>$name = param('bill');
>
>If the box is checked, $name will have a value of "on"
>If the box is NOT checked, $name will be undefined (have no value).
>
>My Question:
>Is there a way to make $name have a value of "off" when the box is UNCHECKED?
>
>Many thanks for your time, Everyone.
>
>
>
>=====
>#########################################
>Warmest Regards,
>Simon K. Chan - [EMAIL PROTECTED]
>
>"Great spirits have always encountered violent opposition from mediocre 
>minds."
>
>-Albert Einstein
>
>__________________________________________________
>Do You Yahoo!?
>Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
>http://im.yahoo.com
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

__________________________________________________
Gunther Birznieks ([EMAIL PROTECTED])
eXtropia - The Open Web Technology Company
http://www.eXtropia.com/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to