dojox.CheckedMultiSelect的值不用dojo.xhrPost发布 [英] Value of dojox.CheckedMultiSelect not being posted with dojo.xhrPost

查看:116
本文介绍了dojox.CheckedMultiSelect的值不用dojo.xhrPost发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 dojo.xhrPost 发布表单时,除了dojox.CheckedMultiSelect的值之外,我会将所有窗体中的字段POST除外,无论什么选项

When I post a form using dojo.xhrPost, I get all the fields in my form POSTed except for the value of my dojox.CheckedMultiSelect, no matter what options are selected.

我的CheckedMultiSelect的声明:

The declaration of my CheckedMultiSelect:

<div dojoType="dojo.data.ItemFileReadStore" jsId="processTypeList" url="json/processtypelist.json.php"></div>
<label for="processTypeSelect">Process Types</label>
<select dojoType="dojox.form.CheckedMultiSelect" name="processTypeSelect" id="processTypeSelect" multiple="true" style="height:166px;" store="processTypeList"></select>

这里是我的xhrPost:

And here is my xhrPost:

<button dojoType="dojox.form.BusyButton" id="logSearchSubmit" busyLabel="Searching..." timeout="5" 
  onclick="dojo.xhrPost({
    url: 'handlers/logsearch.php',
    form: dojo.byId('formSearch'),
    handleAs: 'json'
});">Search</button>

这里是我的POST:

endDate 2009-12-15
postAction  search
processSelect   
searchAttribute none
searchAttributeValue    
startDate   2009-12-15

任何为什么dojox控件值不会被发布的原因,尽管dijit控件的所有值是我的表单的一部分发布?控制是正确的在其他值得注意的人之间,所以我知道它是在形式。

Any reason why the dojox control value doesn't get posted, though all the values of the dijit controls that are part of my form get posted? The control is right in between the other ones who's values get POSTed, so I know it is within the form.

我刚刚添加了另一个按钮执行 console.log(formSearch.getValues())而不是xhrPost,并且我获取登录到控制台的控件的值。所以很明显,dojo知道它,但是当我做一个 console.log(dojo.formToJson(formSearch))我得到所有的表单数据,除了dojox控制再次。

I just added another button to perform console.log(formSearch.getValues()) instead of the xhrPost and I get the value of the control logged into the console. So obviously dojo is aware of it, but when I do a console.log(dojo.formToJson("formSearch")) I get all the form data except for the the dojox control again.

推荐答案

我猜测这是CheckedMultiSelect中的一个错误,它不会将'name'属性从在表单提交中使用的隐藏的选择小部件的声明标记。由于某些IE行为,dijit.form小部件必须以相当的方式执行此操作,将 $ {nameAttrSetting} 直接插入到模板(CheckedMultiSelect.html)中,元件。参见dijit / form / templates / Button.html作为一个例子。

I'm guessing it's a bug in CheckedMultiSelect that it doesn't carry over the 'name' attribute from the declared markup to the hidden select widget that would be used in a form submit. The dijit.form widgets have to do this in a fairly kludgy way due to some IE behavior, inserting ${nameAttrSetting} directly into the template (CheckedMultiSelect.html) at the select element. See dijit/form/templates/Button.html for an example.

CheckedMultiSelect从dijit继承,但需要在自己的模板中复制此修复程序,因为它不能被继承。如果这是解决方案,请考虑提交一个报告和补丁到bugs.dojotoolkit.org。

CheckedMultiSelect inherits from dijit, but needs to replicate this fix in its own template, since it cannot be inherited. If this is the solution, please consider submitting a report and patch to bugs.dojotoolkit.org.

这篇关于dojox.CheckedMultiSelect的值不用dojo.xhrPost发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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