There is a typo in the title of this question. It should be
How to instantiate DynamicForm(JavascriptObject).
----
I would like to know how to instantiate DynamicForm(JavascriptObject).
I have a static file address.json:
My code ate that and produced a JavascriptObject jso. To verify that the json was eaten correctly, I did
which verified it to be
Which means jso is indeed a proper JavascriptObject.
Then jso was fed as an argument
and on attachment to a Canvas, an exception was thrown, which says something similar to
"the object returned from JSNI is not a valid js object".
My questions are
1. Is this the right json structure as an argument for the constructor
?
If not, what is the right structure of the json, which when produced as a JavascriptObject, could be used as the constructor's argument.
2. Is this constructor even meant to be used for constructing the fields of a DynamicForm? If not what is it used for and what should the structure of the JavascriptObject be?
How to instantiate DynamicForm(JavascriptObject).
----
I would like to know how to instantiate DynamicForm(JavascriptObject).
I have a static file address.json:
Code:
var addressjson = {
dataPath : "address",
items : [ {
"type" : "text",
"name" : "street"
}, {
"type" : "text",
"name" : "unit"
}, {
"type" : "text",
"name" : "city"
}, {
"type" : "text",
"name" : "province"
}, {
"type" : "text",
"name" : "country"
}, {
"type" : "text",
"name" : "zip"
} ]
}
eatJson(addressjson);
Code:
JSONObject json = new JSONObject(jso);
Code:
{
"dataPath":"address",
"items":[
{"type":"text", "name":"street"},
{"type":"text", "name":"unit"},
{"type":"text", "name":"city"},
{"type":"text", "name":"province"},
{"type":"text", "name":"country"},
{"type":"text", "name":"zip"}
]
}
Then jso was fed as an argument
Code:
form = new DynamicForm(jso);
"the object returned from JSNI is not a valid js object".
My questions are
1. Is this the right json structure as an argument for the constructor
Code:
DynamicForm(JavascriptObject)
If not, what is the right structure of the json, which when produced as a JavascriptObject, could be used as the constructor's argument.
2. Is this constructor even meant to be used for constructing the fields of a DynamicForm? If not what is it used for and what should the structure of the JavascriptObject be?
Comment