Ticket #6924 (new enhancement)
Form and form widgets: please provide method(s) to get/set serialized values
| Reported by: | yatessc@… | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.4 |
| Component: | Dijit | Version: | 1.1.1 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
For more complex form widgets like DateTextBox/TimeTextBox where the value is a Javascript object (in those cases a Date object), the widget's get/setValue methods return/accept object values, and thus Form.get/setValues also return/expect object values within the values structure. There are circumstances in which it would be useful to get/set the values in a serializable format, such as JSON (see this discussion on the Dijit Development Forum).
I would like to request the addition of get/setSerializedValues methods (or perhaps just serialize/deserialize) to dijit.Form. The getSerializedValues method could perhaps just call the widget's serialize() method if exists, getValue otherwise, and return a JSON formatted string representing the values of the form widgets, while the setSerializedValues method should set the values of the widgets based on an equivalent JSON string. This would presumably require the addition of a corresponding deserialize() method to those widgets that have a serialize method. Obviously, Checkbox type widgets would require similar special handling as in get/setValues to generate/use an array of values.