Reputation: 16851
My domain class is as follows:
String name
Date createdDate
1.) I want createDate to automatically retrieve the current date and time and save it in the database. For now, it gives a drop-down to select day month and year and the enduser have to enter it. How can i fix this?
2.) In the drop-down it gives invalid day values. for example an end-user can enter FEB 31st. Which is incorrect. How can i correct it?
Upvotes: 0
Views: 49
Reputation: 24776
To answer your first question, directly from the Grails documentation:
By default when you have properties called dateCreated and/or lastUpdated in a domain class, Grails automatically maintains their state in the database.
So for example:
class Person {
String name
Date dateCreated
}
Upvotes: 1