Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How to determine, if a form is in Edit Mode
Pls. forgive, if my wording is not correct.
What I want to do is the following.
I have a form that extends GridLayout. The form contains several fields for input and a button that opens a dialog.
When I open the form from a grid, the fields are not editable and I have to click the Edit button.
But the button is alwys visible. As it does not make any sense when the form is not editable, I would like to hide the button.
How can I determine, if the form is opened for editing or read-only?
Are you able to provide screenshots or code to clarify your question?
Alejandro, I have attached a screenshot.
You can see the button beside the non-editable field. The button should not be displayed in this state.
In the second part, I have clicked the "Bearbeiten" button and I now can edit the content of the field. ( either manually of using the dialog behind the button ).
One way of doing that is by setting the button invisible when you create the form and when you click the Abbruch button and make it visible when you click the Bearbeiten button. Something like the following:
abbruchButton.addClickListener(e -> theButton.setVisible(false)); bearbeitenButton.addClickListener(e -> theButton.setVisible(true));
Hope that helps.