Monday, March 15, 2010

Checkbox value not changes when submit form to server

Checkboxes

The status of a checkbox is reflected in the boolean attribute .checked:

var ischecked = obj.checked;  // Retrieve value
obj.checked = true; // Force checked state

When the form is submitted to the web server, the .checked attribute is sent when the checkbox is in the checked state, and it isn't sent when the checkbox is in the unchecked state. You can retrieve or change this value with the .value attribute, as with text fields.

An onclick event is triggered when the checkbox is clicked. If your event handler returns false, the state of the checkbox will not change on Internet Explorer or Mozilla (and other Gecko-based browsers). On Safari, however, the event handler's return value is ignored.

No comments:

Post a Comment