Ticket #6924 (new enhancement)

Opened 6 months ago

Last modified 2 weeks ago

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.

Change History

Changed 6 months ago by bill

  • cc yatessc@… removed
  • reporter changed from guest to yatessc@telkom.co.za
  • milestone set to 1.3

BTW I thought about this some, and considered calling getDisplayedValue()/setDisplayedValue(), but thinking again that doesn't seem like a good idea because of localization issues (ie, if you serialized a form and then sent the data to the server, the dates wouldn't necessarily be in the format expected).

Changed 2 weeks ago by bill

  • milestone changed from 1.3 to 1.4

bumping 1.4 tickets to 1.5, and most 1.3 tickets to 1.4

Note: See TracTickets for help on using tickets.