> But I my application I need to get the input even if it is not checked
(my form is dynamic and I distinguish the cases: input exists and is
cheched / input exists ans is not checked / input doesn't exists)
I know I could use another input such as textfield, but I wonder if
there is another solution that would allow me to keep the checkboxe
and send it even if not checked.
You say it's dynamic, so just in case it's anything like mine - I'm doing
something with PHP & MySQL, this is what I did. I put a hidden field in the
form and link it to the checkbox, like this (a checkbox to click whether or
not a user's address should be visible on my site):
<input name="showaddressControl" type="checkbox" id="showaddressControl"
value="showaddressControl" onClick="this.form.showaddress.value =
((this.checked)?1:0)">
<input name="showaddress" type="hidden" value=""
onChange="this.form.showaddressControl.checked =
((this.value==1)?true:false)">
The first input is the checkbox, and when it's clicked, it sets the hidden
value to 1 (MySQL for TRUE) if the checkbox is checked, and 0 (FALSE) if
it's not.
The second input is the actual value that I get and put from/to the
database. The reason I have an onchange handler in it is that I dynamically
fill it with data on different persons, so whenever its value changes, the
checkbox is changed too to reflect the new value. You could give it a
default value of "null" or "not set" or something to show when 'input
doesn't exist').
Hope this has something to do with what you're doing and that it will help
;)
Cheers,
Daniel
--
There are 10 kinds of people: Those who know binary and those who don't.