Don't allow user to type in date field

I have a date field and I don’t want the user to type in the date. Is it possible to achieve this. Now i have to have unnecessary code to verify the date and all the validations that go along with it. Why was this Not a feature. it would make life much easier with this feature.

I think that one way to achieve this is to do modifications to the client-side code of DateField. Another option might be to hide the input field of your DateField with CSS and then use a disabled Vaadin TextField to show the selected date.


maybe this will help:

If I can give my humble opinion, I think it is bad practice to cripple the user to avoid some work to the programmer…
I like to be able to quickly type a date, it can be faster than playing with buttons. I appreciate I can paste the same date over and over in some tests, for example.
Removing these possibilities might irate (power?) users.
Just my 0.02€, of course.

Now, there can be specialized needs, like selecting only worked days (rejecting week-end days) or similar. The
add-on can help, I suppose (and it doesn’t have an input field!).

I agree that we shouldn’t disable text entry just to not have to write additional validation code.

However, the solution is much more elegant. We need a way to define input masks on date and text fields. That way you could define “MM/DD/YYYY” or DD-MMM-YYYY as the input format and the user would have to conform to the format. Similarly, if you had a text field that you wanted to only be US phone numbers you could set the mask to “(xxx) xxx-xxxx” where x = a digit between 0 - 9.

Any chance this feature is coming soon?


is what you look for. Or might be a good base to build upon.

I just not agree with Philippe Lhoste , why to simply burden our life with complex validations.
I am very much disappointed why do vaadin people donot lmplemented the most important feature with date.

why to simply burden our life with complex validations
Because I prefer to have this burden rather than put it on the shoulders of the users?
Now, you can have specific use cases, restricted input or other reasons, so indeed, if I don’t see this as "
most important feature
", it could be interesting to have it.
A possible workaround would be to use JavaScript to add the ‘disabled’ attribute to the field.