Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: Grails-Calendar 1.0.1
-
Fix Version/s: Grails-Calendar 1.1.0
-
Component/s: None
-
Labels:None
Description
The current version of the calendar plugin does not allow for a value to be set in the form. Good to have when a form is submitted and there are validation errors.
A simple patch could be something like this with a Date instance passed as an arg:
Add value variable (should externalize format):
String value = attrs.value ? new java.text.SimpleDateFormat("MM/dd/yyyy").format(attrs.value) : ""
Update text input control:
<input type="text" id="$name" name="$name" readonly="true" value="$value"/>
It was fixed in 1.1.0.
You can set the value and a defaultValue, the default value will be used when the value is null
<calendar:datePicker value="${book.releaseDate}" />If releaseDate is null, then nothing is setted.
if releaseDate is null, then a current Date is setted.
<calendar:datePicker value="${book.releaseDate}" />