Reputation: 3819
Does Dojo support JSON Object to dijit/form/Form
mapping?
I'm well aware of this but I couldn't find any detailed example of how to do this.
Upvotes: 1
Views: 646
Reputation: 44665
so if I understand well enough (the question is not really that detailed), you want to use an object and all the properties of that object should map to fields in your form? Well, that's possible using the getValues()
and setValues()
function.
For example:
var myObject = {
test1: "test5",
test2: "test6",
test3: "test7",
test4: "test8"
};
registry.byId("form").setValues(myObject);
Retrieving the same kind of object can be done with the appropriate getter, for example:
registry.byId("form").getValues();
I also made an example using JSFiddle.
Upvotes: 2
Reputation: 2698
Dojo has an MVC package, used for binding elemnts to JSON values. The dojo/mvc/at does the widget to json binding
http://dojotoolkit.org/reference-guide/1.9/dojox/mvc.html
Upvotes: 0
Reputation: 1138
DOJO plugin is deprecated in struts 2.1.x - http://struts.apache.org/release/2.1.x/docs/ajax-tags.html
Better use annotations for JSON to form binding , check this - How to bind JSON to Java object in Struts2 using struts2-json-plugin
Upvotes: 0