Hi,
In my form, I have a checkbox that must be checked in order to process
the form. By default, I want it to be checked when the page first
appears. I can do that easily enough by hardcoding the "checked"
property.
My problem occurs when I try to validate it.
If the visitor unchecks the checkbox, the form cannot be processed,
and I must allow the user to correct the problem (along with any other
fields that were not filled out correctly).
I want to use CSS to change the labels of any missing or bad fields to
red. That part seems to be coded correctly (see below).
<tr>
<td colspan="2" class="<? echo (!isset($checkTelephone_err) ?
'form-labels-error ' : 'form-labels'); ?>"><input
name="checkTelephone" type="checkbox" value="OK2Call"> Yes, I
authorize you to contact me via telephone.</td>
</tr>
The part that I'm not sure about is how to default the checkbox to
checked when the form first appears, and yet allow for
unchecking/checking after the form is submitted a first time.
Sorry. I know the explanation is a bit vague. I'm having trouble
elaborating well. If you have any tips or suggestions, please let me
know.
- Eric