Possible duplicate:asp.net mvc: why does Html.CheckBox generate additional hidden input
I show a checkbox in an asp.net mpc application, and the control also displays a hidden field as follows:
<input id="blah-64" name="blah-64" value="true" type="checkbox"> <input name="blah-64" value="false" type="hidden">
The problem is that when I submit the form, the bla-64 form key is turned off.
Why is this?
If you look at the source code for the checkbox helper, you will see a comment that explains it. It looks like this:
if (inputType == InputType.CheckBox) { // Render an additional <input type="hidden".../> for checkboxes. This // addresses scenarios where unchecked checkboxes are not sent in the request. // Sending a hidden input makes it possible to know that the checkbox was present // on the page when the request was submitted. ...
, W3C , : " , "on" ". ( ). , , . , HTML .
Source: https://habr.com/ru/post/1783485/More articles:ASP.NET MVC 2 Where to put the logic - asp.net-mvc-2row selection in vba task - vbaHow to combine case-insensitive value with XPath - xpathYoutube python: get thumbnail - pythonEdit script action in swf files - flashHow to remove confirmation on iPad in accordance with user interface guidelines - user-interfaceВнедрение EAS для Zend Framework - phpPaper form for database - mysqlURL conventions for Maps on Windows Phone 7 - javascriptКак построить диаграмму Венна с 4 наборами - graphicsAll Articles