Text select in DateField


the TextField offers a method called “selectAll()” to select/highlight the text inside the field… I need this kind of functionality for the DateField component. Anybody has an idea how to accomplish this programmatically?

Thanks in advance!


the selection range setting for the TextField is a feature in the client side class VTextField. The VPopupCalendar (client side class of DateField) does not use a VTextField, but a simpler gwt widget (TextBox). Due to this I don’t think there is a server-side way to go around this.

You might be able to extend the VPopupCalendar and DateField classes and provide the needed functionality yourself. You may also want to create an enhancement ticket for this functionality in the vaadin trac.


thank you for the quick reply! When I tab into a DateField, the date text is selected… can’t I simulate this behaviour somehow?

I think the select-all on tabbing into the date field is a feature of the browser. Of course you could try to call focus() on your DateField but if I remember correctly that will not select the text value.

So, I can’t think of a simple workaround for this. Hopefully someone else could help.