Incorporating dForm into my MVC application has been a smooth process. Creating a form from the JSON string below works perfectly:
var formdata = {
'action': 'index.html',
'method': 'get',
'elements':
[
{
"type":"select",
"name":"Name",
"caption":"Name",
"options":"first":{"html":"first","class":"active"},
"second":{"html":"second","class":"active"},
"selected":null
}
]
};
However, when I attempt to use the generated elements as shown in the code snippet below:
var elements = {
"action": "index.html",
"method": "get",
"elements":
[
$('#jqgrid').jqGrid('getGridParam', 'userData')
]
};
$('#myform').buildForm(elements);
I encounter the following error message from dform:
uncaught exception: No element type given! Must always exist.
Despite ensuring that the "elements" tag mirrors what was originally posted, the issue persists.
Upon inspection with Firebug, I noticed the userData retrieved for jqGrid is in the format:
"userdata":"{\"type\":\"select\",\"name\":\"Name\",\"caption\":\"Name\",\"options\":{\"first\":\"first\" .....
The userData is generated from JObject, leading me to suspect that this might be contributing to the problem. Attempts to address this by replacing the escaping character '\,' have proven unsuccessful.