I have a domain object with a setter method that takes in a map of id, value pairs. This is not just a plain association, and this setter method has some login in it. For example:
class DomainObj{
def setTheMap(map){
//do stuff with the map
}
}
I have a form where the user can type in a value for each id. My goal is that when the user posts the data back and I set domainObj.properties = params, the method setTheMap will be called passing in a hash of the form:
[id1: 'string1', id2: 'string2', id3: 'string3']
However, I can't figure out how to format the text-fields in the view to accomplish this. Currently I have to following which does not work:
<g:textField name="theMap.id1" value="string1" />
<g:textField name="theMap.id2" value="string2" />
<g:textField name="theMap.id3" value="string3" />
Is there an easy way to accomplish this? I was reading that as of grails 1.1 you can do this sort of thing for maps of associations, but I can't find any info about doing this for arbitrary setter methods.