Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 27: | Line 27: | ||
=== Multiple-choice fields === | === Multiple-choice fields === | ||
The field() function returns an array of selected items from multiple-choice (Checkboxes & Multiple-choice list) fields. Therefore, if a comma-separated list of selections is desired for the result of a JavaScript field expression, it is necessary to fetch the items from the array and combine them into a string, separated by commas. This is easily done with the array method join(). | The field() function returns an array of selected items from multiple-choice (Checkboxes & Multiple-choice list) fields. Therefore, if a comma-separated list of selections is desired for the result of a JavaScript field expression, it is necessary to fetch the items from the array and combine them into a string, separated by commas. This is easily done with the array method join(). | ||
==== Getting a comma-separated list of checked items from a multiple-choice field ==== | |||
{| | {| | ||
! JavaScript field | ! JavaScript field | ||
Line 43: | Line 44: | ||
|} | |} | ||
Alternatively, if the trigger script needs to handle each of the choices individually, it can be done as follows: | Alternatively, if the trigger script needs to handle each of the choices individually, it can be done as follows: | ||
==== Handling checked items individually ==== | |||
{| | {| | ||
! Trigger script | ! Trigger script |