I'm trying to use multiple values for a select using <g:select multiple='true'>
, but when i try to save the form to the DB, i got this error
Property [Languages] of class [class com.Myapp.hr.EmploymentSeeker] with value [french,english] is not contained within the list [[french, english, russian, chinese]]
here is my Domain:
class EmploymentSeeker {
Set<String> languages = [] as Set
static hasMany = [ languages: String ]
static constraints = {
languages(nullable:true,inList:Holders.config.languages)
}
}
Config file :
languages=[
'french',
'english',
'russian',
'chinese'
]
GSP:
<g:select multiple="true" name="languages" from="${employmentSeekerInstance.constraints.languages.inList}" value="${employmentSeekerInstance?.languages}" valueMessagePrefix="empSeeker.languages" noSelection="['': '']"/>
what may cause this error ?