Do not disable checkboxes

To make a checkbox uncheckable, one common mistake is to

<input name="test" type="checkbox" value="1" checked disabled="true">

the disabled checkbox actually makes the checkbox unusable. So if you have some scripts to be triggered after the form is submitted, the checkbox test field will not come in at all. If you don’t want people to mess with the checkbox, making it “readonly” will also not help. One way is to hid it using css.

<input name="test" type="checkbox" value="1" checked style="display:none">

Another way is to use javascript to make it unclickable, ie

jQuery('#your_id').click(function() { return false; });
Like it.? Share it:
Tags: ,

Comments are closed.