Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
ComboBox selection change event ?
I would like to give the user a warning (and a chance to confirm) when he changes the value of a ComboBox (in single-select mode). This applies only to changes via the GUI, it shouldn't fire for programmatic changes to the selection.
The ValueChange event happens after the change has been carried out so I guess I cannot use that one.
How can I accomplish this ? I'm thinking I need to subclass ComboBox and override something (perhaps setInternalValue() ?) but I'm not quite sure how to distinguish GUI changes to the value from programmatic changes to the value. Also not sure this is the correct path ?
You could still use the ValueChange. Why not just permantly store the previous value? And then compare and prompt the user. If they do want to confirm then set the value of the combobox to the old stored value?
Shaun Wallace: You could still use the ValueChange. Why not just permantly store the previous value? And then compare and prompt the user. If they do want to confirm then set the value of the combobox to the old stored value?
Yeah, thanks. That's what I ended up doing.