Hi,
I need some help in how to code dynamic select options based on the ‘model’ provided by the server.
I have the basics working for a single ‘username’ see below.
Note: There would be a test around the lightboxsections to see if the dynamicpart was needed at all.
But I am struggling when instead of a ‘username’ the model provides a list of ‘usernames’.
I can see how I can use JSTL to loop round the list.
<c:foreach var=”entry” items=”user.list”>
</c:foreach>
I am struggling to understand the Javascript to create the correct contents inside the loop taking into account the need for commas between the ‘options’.
[code]
var dynamicpart;
var dynamicpart = {key:“Username”,label:"${user.username}"};
var lightboxsections = [
{name:“text”, height:150, map_to:“text”, type:“textarea” , focus:true},
{name:“type”, height:21, map_to:“typeofevent”, type:“select”, options:[
{key:“A”, label:“A”} ,
dynamicpart
]},
{name:“time”, height:72, type:“time”, map_to:“auto”}
];
[\code]
Thanks for any help.