Daryl
October 16, 2014, 8:15pm
#1
Hi Folks,
I am trying to build a form with multiple fieldsets. I am using the json format like so:
fieldData = [
{
type:"fieldset", name:"fieldset1", label:"fieldset1", inputWidth:"auto",
list:[
{type:"input", name:'foo', label:'foo'},
]
}
{
type:"fieldset", name:"fieldset2", label:"fieldset2", inputWidth:"auto",
list:[
{type:"input", name:'bar', label:'bar'},
]
}
];
What happens is both input elements (foo and bar) are displayed in fieldset1
and fieldset2 exists but is empty.
Any help would be much appreciated,
Thanks Daryl
Avalon
October 17, 2014, 9:16am
#2
Hi, Dude!
It works fine (ver. 3.6 and 4.0).
But, to say the truth, I fixed error - added comma.
in html:
formData = [
{
type:"fieldset", name:"fieldset1", label:"fieldset1", inputWidth:"auto",
list:[
{type:"input", name:'foo', label:'foo'}
]
},
{
type:"fieldset", name:"fieldset2", label:"fieldset2", inputWidth:"auto",
list:[
{type:"input", name:'bar', label:'bar'}
]
}
];
or json file:
[
{
"type":"fieldset", "name":"fieldset1", "label":"fieldset1", "inputWidth":"auto",
"list":[
{"type":"input", "name":"foo", "label":"foo"}
]
},
{
"type":"fieldset", "name":"fieldset2", "label":"fieldset2", "inputWidth":"auto",
"list":[
{"type":"input", "name":"bar", "label":"bar"}
]
}
]
Daryl
October 17, 2014, 7:37pm
#3
Hi Avalon, Thanks for your response, much appreciated. Actually my string representation of the data didn’t give the full picture. Let me explain. I am actually creating several json objects with the form:
{
type:"fieldset", name:"fieldset1", label:"fieldset1", inputWidth:"auto",
list:[
{type:"input", name:'foo', label:'foo'}
]
}
and they are then pushed onto an array that is then used to instantiate the form that attaches to a tab bar, i.e.
formData = [];
formData.push(json1);
formData.push(json2);
formData.push(json3);
tabBar.cells("a").attachForm(formData);
Can you see anything wrong with this approach?
Thanks,
Daryl
Avalon
October 20, 2014, 8:31am
#4
It works fine.
Maybe your json1, json2, … have same name: fieldset1 ?
Daryl
October 20, 2014, 5:47pm
#5
Embarrassingly enough you were right. Thanks for your help, I appreciate it. All is working well now.
Daryl