|
|
|
I'm on Grails 1.0.1 and workaround 1) doesn't work for me.
I have: <g:datePicker precision="day" name="publicLiabilityExpiry" value="${contractor?.publicLiabilityExpiry}" default="none" noSelection="${['':'--']}"/> and need to use Option 2 to get it to work. Seems that I wasn't precise enough: (1) and (2) are not different alternatives but the 2 steps of the workaround
|
||||||||||||||||||||||||||||||||||||||||||
1) use g:datePicker undocumented default="..." attribute in the view
<g:datePicker name="myDate" value="${new Date()}" noSelection="['':'-Choose-']" default="none"/>
2) remove the field from the map used for binding if some/all fields is/are empty
def excludes = []
if (!params.myDate_day)
excludes << "myDate"
bindData(myDomainObject, params, excludes)
(note that this has to be done in both save and update and that bindData has to be used rather than properties assignment)