Foren
get multiselect selected values in velocity
juan meza, geändert vor 8 Jahren.
get multiselect selected values in velocity
Regular Member Beiträge: 228 Beitrittsdatum: 06.01.14 Neueste Beiträge
Hi, I have liferay 6.2 GA4
I have a dynamic data list, and in my structure i have a select, with the multiselect option on...
i want to do a template... but i cant find how to iterate the multiselect selected values...
so far i have:
this prints the values as an array - ["value1","value 2"]
I need to iterate, maybe something like this:
what am i missing?
thank you
I have a dynamic data list, and in my structure i have a select, with the multiselect option on...
i want to do a template... but i cant find how to iterate the multiselect selected values...
so far i have:
$cur_record.getFieldValue("SelectRoles", $locale)
this prints the values as an array - ["value1","value 2"]
I need to iterate, maybe something like this:
#foreach($selectRole in $cur_record.getFieldValue("SelectRoles", $locale))
$selectRole.getName()
#end
what am i missing?
thank you
Harish Kumar, geändert vor 8 Jahren.
RE: get multiselect selected values in velocity
Expert Beiträge: 483 Beitrittsdatum: 31.07.10 Neueste Beiträge
try this
#foreach($selectRole in $cur_record.getFieldValue("SelectRoles", $locale))
$selectRole
#end
juan meza, geändert vor 8 Jahren.
RE: get multiselect selected values in velocity
Regular Member Beiträge: 228 Beitrittsdatum: 06.01.14 Neueste Beiträge
Hi Hasrish, thank you
I tried your option but it didnt work
I checked and
this does not even iterate... i try to write just a random letter... and it doesnt do anything...
but if i put this alone, it does print the value i mentioned
it prints exactly this: ["Administrator","User"]
do you know why? any ideas i can try?
I tried your option but it didnt work
I checked and
#foreach($selectRole in $cur_record.getFieldValue("SelectRoles", $locale))
this does not even iterate... i try to write just a random letter... and it doesnt do anything...
#foreach($selectRole in $cur_record.getFieldValue("SelectRoles", $locale))
1
#end
but if i put this alone, it does print the value i mentioned
$cur_record.getFieldValue("SelectRoles", $locale)
it prints exactly this: ["Administrator","User"]
do you know why? any ideas i can try?
juan meza, geändert vor 8 Jahren.
RE: get multiselect selected values in velocity
Regular Member Beiträge: 228 Beitrittsdatum: 06.01.14 Neueste Beiträge
did not figure this out, i think its a string with all the values, not an array...so the iteration wont work..
so i did an indexOf just searching for my values... thats what i needed anyway... just to know if the value was inside of one of the selections
so i did an indexOf just searching for my values... thats what i needed anyway... just to know if the value was inside of one of the selections