leandrobortoli / vaadin-inputmask

Vaadin Extension to allow masked inputs.
https://vaadin-inputmask-demo.herokuapp.com/
Apache License 2.0
4 stars 2 forks source link

DateField doesn't see the entered value. #1

Closed oleg97g closed 6 years ago

oleg97g commented 6 years ago

Open online demo, try to enter some text (according to the mask) into the date field and then press the "calendar" button: you will see that the component just ignores input value: calendar's position is set to default, but it should correspond to the date entered. I tried to play with the Input Mask JavaScript plugin myself (using Vaadin's JavaScript.execute), it seems when a JavaScript is executed against the textfield (next to the "calendar" button) the whole component loses its ability to read the entered value properly - it just ignores it. On the server side no ValueChange event is triggered, not even handleUnparsableDateString. It seems the client component just doesn't know that something has been typed into the field.

leandrobortoli commented 6 years ago

The problem was related to this issue on the javascript plugin, where the event triggered by jquery don't trigger native events. Changing the dependency lib to vanilla fixed the problem.

oleg97g commented 6 years ago

Still doesn't work for DateField. Changed to 1.0.1 version. Now instead of the proper mask I see this in the DateField: "d_te". Trying to enter the value with Calendar button also fails: the field remains empty.

upd: It seems it has something to do with aliases. Alias string goes directly as mask. Thus if your code is like this:

InputMask dateInputMask = new InputMask(Alias.DATE);

the Alias.DATE's value ("date" in this case) goes directly to the mask of client component, instead of actual mask (e.g. "99.99.9999" or whatever).

Also, when the Vaadin DateField's dateFormat property doesn't correspond the mask, the result may be unexpected. Maybe apply the dateFormat as default mask? Or at least it should be mentioned somewhere.

Everything else seems to work just fine.

leandrobortoli commented 6 years ago

I've fixed the issue with the date alias, I was using an unstable version of the javascript plugin, my bad. As for the dateFormat, using dateFormat as the default mask is a good idea, I'll try to implement it later, but apparently, the date extension in the input mask plugin is going through some changes, so I'll wait a bit.