【发布时间】:2011-05-18 10:38:06
【问题描述】:
我发现了类似的问题 (when checkbox is checked, wrong value is submitted for the property),但它并没有解决我的问题。
我使用 jgrid 进行数据呈现和编辑。如果我只使用文本字段,一切都会很好,但是当我开始使用复选框时它会失败。我真的很简单地使用默认值编写代码:
colModel:[ {name:'robotsi',index:'robotsi', width:90, align:"right",sortable:false,editable:true,edittype:'checkbox'} ]
在 HTML 中它看起来很漂亮:
<input id="robotsi" class="FormElement" type="checkbox" value="on" offval="off" name="robotsi" role="checkbox">
但是当我点击“提交”时,我得到了:
[robotsi] => off
即使我检查它...当我添加时:
editoptions: { value:"Yes:No" }
它的工作原理相同,我得到的唯一值是 0。我根本没有 JavaScript 错误。
请帮我看看我犯了什么错误。
【问题讨论】:
-
你有什么版本的jQuery?
-
我有最新的 jQuery。我只是使用选择而不是复选框来解决它。