user460667 user460667 - 5 months ago 8
HTML Question

HTML Input Checkbox return 'On' instead of 'True' when submitting form

I have a MVC3 app using Project Awesome (http://awesome.codeplex.com/), but I am getting a weird behaviour on checkboxes. I have the following simple Html within a Modal popup

<input type="checkbox" class="check-box" name="IsDeleted">


When I submit the form containing this element, its post value is 'on' instead of the expected 'true' (when element is checked).

Does anybody know why this is? I am assuming there may be some javascript somewhere messing with the form data, but wanted to check whether there isn't some HTML I am missing.

Thanks

Answer

Set the checkboxes value attribute to true and you will get true in your post value.

Comments