提交表单时,HTML Input Checkbox返回"On"而不是"True" [英] HTML Input Checkbox return 'On' instead of 'True' when submitting form

查看:343
本文介绍了提交表单时,HTML Input Checkbox返回"On"而不是"True"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Project Awesome(http://awesome.codeplex.com/)的MVC3应用程序,但是我在复选框上出现了奇怪的行为.我在Modal弹出<input type="checkbox" class="check-box" name="IsDeleted">

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">

当我提交包含此元素的表单时,其后置值为"on",而不是预期的"true"(选中该元素时).

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

有人知道这是为什么吗?我假设某个地方可能有一些javascript弄乱了表单数据,但想检查我是否缺少一些HTML.

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.

谢谢

推荐答案

将复选框value属性设置为true,您将在帖子值中获得true.

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

这篇关于提交表单时,HTML Input Checkbox返回"On"而不是"True"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆