Why does Asp.net MVC use the HTML. checkbox check box to generate an additional hidden field input type = "hidden"

Source: Internet
Author: User

Html. checkbox ("foo ")Generate two input changes instead of one. Who knows why?

<Input id = "foo" name = "foo" type = "checkbox" value = "true"/>
<Input name = "foo" type = "hidden" value = "false"/>

If the check box is not selected, submit the form field. This is why we always get the value of false (in the hidden field ).

If you leave the check box selected, there will still be a value in the form of hidden fields. This is the value of the Asp.net MVC processing check box.

If foo is not selected, the hidden domain will wear a false value to the background.

Website development _ website production _ website maintenance _ online shop production _ online shop installation _ mall production _ mobile phone software _ enterprise website _ office software _ QQ: 471226865

Point more healthy

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.