开发者

dijit Form toJson returns empty object for dijit.form.DateTextBox

Runni开发者_Python百科ng the following code:

dojo.toJson(formSearch.attr("value"));

Appears to not serialize the value of dijit.form.DateTextBox controls. Looking in Firebug, I can see that formSearch.attr("value")) returns the appropriate DOM object that contains the value that the control is set to, but when I try to serialize it, I get something like:

{"startDate":{}}


The value attribute of a dijit.form.DateTextBox is of type Date. This is useful to manipulate Dates from JavaScript, but by default there is no serializer for Dates to JSON. If you wish to get the value of the widget for serialization, use dijit.form.DateTextBox.serialize(), which will give you the value as a string.

If you use the DateTextBox in a or a dijit.form.Form, the serialization should happen for you on submit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜