Ext JS form.getValues()检索复选框的错误值(Ext JS form.getValues() retrieves bad values for checkboxes)

编程入门 行业动态 更新时间:2024-10-27 13:32:54
Ext JS form.getValues()检索复选框的错误值(Ext JS form.getValues() retrieves bad values for checkboxes)

所以我有一个带有两个checkbox的form 。 当我调用form.getForm().getValues()并记录values ,它会检索这样的checkbox值:如果选中它,则值看起来像这样 - SomeCheckbox: "on" ,如果没有检查它的值根本不存在。 然后我将这些值编码为JSON并将其发送到ASP.NET MVC,并且这些checkboxes ASP检索值始终为false。 我想出的解决方案是在获取form值后设置我从form检索的values的SomeCheckbox属性,它工作得很好,但是没有其他方法吗?

解:

调用form的getFieldValues()方法而不是getValues()

So I have a form with two checkboxes. When I call form.getForm().getValues() and I log the values, it retrieves checkbox values like this: if it is checked then the value looks like this - SomeCheckbox: "on", and if it's not checked than the value is not there at all. And then I encode those values into JSON and send it to ASP.NET MVC and the values ASP retrieves for these checkboxes are always false. The solution I came up with is to set the SomeCheckbox properties of the values I retrieve from form after getting form values and it works just fine, but is not there any other way ?

SOLUTION:

call form's getFieldValues() method instead of getValues()

最满意答案

调用表单的getFieldValues()方法而不是getValues()

call form's getFieldValues() method instead of getValues()

更多推荐

本文发布于:2023-07-26 05:09:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1271336.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:复选框   错误   getValues   form   Ext

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!