It seems like this question would have been asked before, but I couldn't
find an answer in the archives.  I am able to successfully use the
html:checkbox tag.  However, this tag seems to be trickier to use when you
want to default the box to "checked".  Simply setting the form attribute to
true won't work, since an unchecked value will not be submitted and the form
attribute will remain true.  I've actually got this to work by what seems to
be a hack.  To force the browser to send a value when the box is unchecked,
I used the following Javascript:

if (document.getElementById("flag").checked == false) {
    // Force the browser to send a value
    document.getElementById("flag").checked = true;
    // Set the value to false
    document.getElementById("flag").value="false";
} 

This actually works fine, although the checkbox is toggled briefly to
"checked" before the form is submitted.  Is there a better to way to handle
checkboxes that need to default to "checked"?

Thanks,
Dave

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

Reply via email to