I am having an issue displaying the selected values when I open the contentlet. If I see the velocityVarName valuable just printing it like this:
$context.get("${field.velocityVarName}") I can see the values all isted as (1,2,3,) ending with a comma.
<option value="$con.identifier"
#foreach($id in $context.get("${field.velocityVarName}"))
#if($id == $con.identifier)selected#end
#end
</select>
But it does not display the selected values. Any suggestions are welcome!
Thank you,
Alex
<select multiple="multiple" size="scrollable" id="myMultiSelectField" onchange="updatemyMultiSelectField()" style="width: 200px;" ""="">
#foreach($con in $dotcontent.pull("xxxx"))
<option value="$con.indentifier"
#if($context.get("${field.velocityVarName}") == $con.identifier)selected#end - I have to put this condition through a loop or something.
#end
</select>
##field to store the value
<input type="hidden" id="myMultiSelectFieldId" value="">
<script type="text/javascript">
function updatemyMultiSelectField() {
var myMultiSelectFieldValueList = "";
var multiselect = $('myMultiSelectField');
for(var i = 0; i < multiselect.options.length; i++) {
if(multiselect.options[i].selected) {
myMultiSelectFieldValueList += multiselect.options[i].value + ",";
}
}
$('myMultiSelectFieldId').value = myMultiSelectFieldValueList;
}
updatemyMultiSelectField();
</script>