选中复选框时,属性提交的值错误 [英] when checkbox is checked, wrong value is submitted for the property

查看:84
本文介绍了选中复选框时,属性提交的值错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在jqgrid中,该列的定义如下:

In the jqgrid, the column is defined as following:

  {name:'production', index:'production', width:60, align:'center', formatter:'checkbox',editable:true,edittype:'checkbox',editoptions:{value:"true:false"},formoptions:{ rowpos:10,elmprefix:" " }},

用于编辑表单的html如下:

Generated html for the edit form is the following:

<input type="checkbox" value="true:false" offval="false" id="production" role="checkbox" class="FormElement">

所以,当复选框被选中时,正确的值假"被提交,但是当复选框被选中,真:假"被提交,这显然是错误的.我希望提交"true".我在做什么错了?

So when the checkbox is unchecked, the correct value 'false' is submitted, but when the checkbox is checked, 'true:false' is submitted, which is obviously wrong. I would want 'true' to be submitted. What am I doing wrong?

谢谢!

推荐答案

尝试删除这样的编辑选项:

try removing editoptions like that :

{name:'production', index:'production', width:60, align:'center', formatter:'checkbox',editable:true,edittype:'checkbox',formoptions:{ rowpos:10,elmprefix:"&nbsp;" }},

来自jqgrid Wiki:

from jqgrid wiki :

如果在editoptions中,则为value属性 未设置,jqGrid搜索 跟随值 (false | 0 | no | off | undefined)以便 构造复选框.

If in editoptions, the value property is not set, jqGrid searches for the following values (false|0|no|off|undefined) in order to construct the checkbox.

因此它应该适用于true:false开箱即用.

so it should work for true:false out of the box .

还要确保数据中的生产价值为真值或假值

Make also sure that in your data you have production as true or false value

这篇关于选中复选框时,属性提交的值错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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