Could you please anyone tell me how to get multiple values from
I have this in my create.gsp
According to this docs: http://www.grails.org/doc/1.3.7/ref/Tags/select.html your select tag is wrong, it should be rather:
<g:select name="validator.id"
multiple="multiple"
optionKey="id"
from="${com.project.Validator.list()}"
value="${contact?.validators*.id}" />
Your MME
is because the get()
on Domain classes only handles one id at a time. For multiple ids from your <select/>
use.
def validators = Validator.getAll(params.list('validator.id'))
The params.list()
will always fetch 'validator.id' as a List even if there's only one, which will save you from having to test for single vs multiple results from your <select/>
.