Multi-select custom field


This builds on the codeshare Stephen Bell provided for using a custom field with a select. This uses a multi-select and reads back in multiple values and resets them when the contentlet is opened.


/* When page is loaded, copy the hidden field value to the dropdown, initialValues is an array after split */
                var initialValues =
                var iLength = initialValues.length;
                for(var i = 0; i<iLength; i++){
                   ${esc.dollar}("${esc.hash}curriculumAssociation_field select
                    if(${esc.dollar}(this).val() == initialValues[i]){

Have you created code you'd like to share with the dotCMS community?

Share your code Become a Contributor