htmlwicketwicket-1.5wicketstuff

How do I use html5 calendar input type in wicket


I'm experimenting with HTML5. What I'd like to know is how does Wicket work with HTML5 input types such as date and email, if at all? Currently Wicket uses java script to generate a calendar for date inputs.

What complicates this issue is how would Wicket handle a browser that doesn't support HTML5 input tags of type date (and the other new HTML5 tags).


Solution

  • Wicket (1.5 and onwards) doesn't support input type='date' or similar constructs out of the box. There's a DateTextField in Wicket Extensions, but it doesn't specify type='date' (yet). I'd suggest creating your own implementations that properly set the type attribute (my guess to why they haven't been added to the field is that it would break existing applications).

    There's EmailTextField, NumberTextField and others. These add the type attribute and validate the input on the server.

    Browsers that don't support HTML5 inputs fallback to type='text', so for a Wicket point of view there's nothing different. Wicket will still validate the input according to the set rules.