Hi Kiranped,
Yes, you can. The multi-select field will return an ArrayList of Strings when you call the getValue method on its FormField.
Then, you can check the size of the array:
def multiSelect = getFieldById(getFieldChanged())
def multiSelectValue = multiSelect.getValue() as ArrayList
if (multiSelectValue.size() > 1) {
multiSelect.setError("Please select only 1 value")
} else {
multiSelect.clearError()
}
Hope this helps :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.