<input type="checkbox" disabled="disabled" checked="checked" name="is_ok" id="id_is_ok"/>
How to add default value of this input? (This input is disabled)
If this field in disabled If I edit my data, this value is not saved.
<input type="checkbox" disabled="disabled" checked="checked" name="is_ok" id="id_is_ok"/>
How to add default value of this input? (This input is disabled)
If this field in disabled If I edit my data, this value is not saved.
Yes, if the field is disabled, it is not send when the form is submitted.
If you want to have a field that cannot be edited but is submitted with the form, use readonly="readonly"
instead.
Edit: Argh, this does not work, readonly
is ignored for checkboxes, see comment below. Instead if you want to send that field value on submit, you can define a second hidden field with the same name and value:
<input type="checkbox" disabled="disabled" checked="checked" name="is_ok" />
<input type="hidden" name="is_ok" id="is_ok_hidden" value="some value here" />
(You can give that field a value="some value here"
like any other html input field, and set that value via element.setAttribute("value","some other value")
in JavaScript. As only value of the type="hidden"
field is send, only set the value of that field and ignore the value for the checkbox.)
<input type="checkbox" disabled="disabled" checked="checked" name="is_ok" value="bike" id="id_is_ok"/>
here bike is default value...