Calendar Plugin

Allow for value to be set in the Calendar

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Trivial 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"/>

Activity

Hide
Maxwell Chiareli added a comment -

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.

<calendar:datePicker value="${book.releaseDate}"  defaultValue="${new Date()}"/>

if releaseDate is null, then a current Date is setted.

Show
Maxwell Chiareli added a comment - 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.
<calendar:datePicker value="${book.releaseDate}"  defaultValue="${new Date()}"/>
if releaseDate is null, then a current Date is setted.
Hide
Randal Clanahan added a comment -

Would like to be able to use the calendar and optionally type in the date. Why must this be readonly... and is there a way to change it.

Show
Randal Clanahan added a comment - Would like to be able to use the calendar and optionally type in the date. Why must this be readonly... and is there a way to change it.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: