By default a java.util.Date
field is represented in a CRUD form as a simple "DATE" input.
public class DatedModel extends Model {
public Date creationDate;
in the CRUD admin I see:
creationDate [TEXTINPUT]
yyyy-MM-dd format.
Is there any way to have a DateTime input instead, on selected fields only (not all of them modifying the application.conf date.format
)?
Is there a way to affect which "widget" is used for a given field in the 'automated' CRUD admin?
Something like this in your application.conf:
Then in the model:
Your controller:
Documentation
Working demo: https://github.com/saxxi/play-framework-test
I finally found in the documentation my answer:
You can indeed customize each field; a more extensive example can be found on the lunatech blog using jquery datatables which also shows how to modify pagination.
PS.
@AditSaxena hint was good and indeed a simple solution; but not what I wanted because it's not acceptable that the 'hint' is not correct! Clearly confusing for a user!
So for a datetime input (the specific question) we can combine the annotation (described in the doc)
with a custom hint, eg.
I'll also point out that you can write your own validator
Other related useful questions: