Announcement Announcement Module
Collapse
No announcement yet.
Date binding from 3 text fields Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Date binding from 3 text fields

    I wonder if there is a nice way to enter java.util.Date field from 3 HTML fields: [dd] - [mm] - [yyyy]. I looked through ServletRequestDataBinder but it looks like there is no way to compose a single property from several input fields. I can only see solution that creates DateBean custom bean extending java.util.Date with date, month, year properties. Anyone has any sugessions ?

    Thanks.

  • #2
    I can only see solution that creates DateBean custom bean extending java.util.Date with date, month, year properties.
    That would work. Not sure how else it could be done as Spring maps from form input fields to properties.

    Anyone has any sugessions ?
    Use Javascript to combine them into one field (yuk).

    Keeping the fields separate means you can validate them separately if you want to. E.g. Day of 30 is invalid if month is Feb.

    Comment

    Working...
    X