Tips:Using JavaScript in Memento: Difference between revisions

Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 26: Line 26:


=== 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().
{|
{|
! JavaScript field
! JavaScript field