in a view I display a form with many controls
if a user change values in one or more controls, and the user try to exit without saving . I want to show a message asking if he want to save before exit
is a way to identify, if in any control, user changes values (without compare manually, in each control, initial vs actual value)
thanks for any help
Hi,
first of all sorry for late response.
In Vaadin 7 FieldGroup has a isModifed mehod but I think you need some custom code to listen to field changes.
For example you could call FieldGroup.getFields() and for each field attach the same ValueChangeListener that checks for FieldGroup.isModified().
Or you can can extend FieldGroup (or BeanFieldGroup) and override configureField method to add the ValueChangeListener listener.
Or you can use MBeanFieldGroup from Viritin addon on which you can attach a FieldGroupListener (MBeanFieldGroup.withEagerValidation(listener)) that is invoked every time a field value changes (like described above)