A value list has no concept of ‘selection’…
There’s no selected value in the value list, this is something that happens in the dropdown (if it is set to multi select), and you will retrieve the selected values in a submit of a form, or eventually use jQuery to get a hold of the selected items. But this is something that happens in the browser, then to retrieve these in Servoy you need to submit.
My mistake. I was talking about a combobox. Should have been a checkbox off course.
What I want to do is show the selected values from a checkbox field in an VR.
For example: In the DB there will be a value like “2\n3” when two items are checked in a checkbox field in Servoy. $valueLists.getDisplayValue does not work here because that only returns one value.
application.getValueListDisplayValue('valueList', "2\n3") wouldn't work either.
You would have to do a split first:
var values = "2\n3".split("\s");
for (var i = 0; i < values.length; i++) {
application.output(application.getValueListDisplayValue('valueList',values[i]));
}
So in a template you could do something like this:
#set($values = $value.split("\s"))
#foreach($val in $values)
$valueLists.getDisplayValue("yourValueList", $val)
#end