Let's say I have a datePicker called "foobar":
<g:datePicker name="foobar" value="${new Date()}" precision="day" />
How do I read the submitted value of this date-picker?
One way which works but has some unwanted side-effects is the following:
def newObject = new SomeClassName(params)
println "value=" + newObject.foobar
This way of doing it reads all submitted fields into newObject which is something I want to avoid. I'm only interested in the value of the "foobar" field.
The way I originally assumed this could be done was:
def newObject = new SomeClassName()
newObject.foobar = params["foobar"]
But Grails does not seem to automatically do the translation of the foobar field into a Date() object.
Updated: Additional information can be found in the Grails JIRA.