Re-initialize text fields in vaadin forms (vaadin 10 and html templates)


We just started to develop an application with vaadin 10 and html templates.

Our application in short: add and edit users from a list.

We display from our main view a list of users. In order to add/edit users, we type in values into text fields of a user form. Then, when we switch to another user, e.g., to edit it. Some of the edited user’s values are still “cached”/visible from the previous user form. This happens only in case when the text field values loaded from the bound data type are empty, e.g., empty strings. Otherwise, the values are overwritten, as expected. However, we would want these fields to be loaded empty. As these values are empty in the bound user data. We observed that this behavior is only occurring when the user form is opened on the same page or opened in a dialog. When we navigate to another page an back, the fields are emptied.

Is this the expected behavior? How can we re-initialize or control the “cached” values of the user form?

We have a dialog/vertical layout using templates and we use data binding. As, e.g., shown below:

<vaadin-text-field label="Personnel Id" value="{{user.personelId}}"></vaadin-text-field>

Thank you for your help!

Not really a solution for this particular error, but have you had a look at binders? They take care of reading and setting the values for you, so that you do not have to set it yourself (especially when validation and so on is coming into play)? (the fields of this example could be of course also fields from your Polymer template, loaded by @Id(...))

Thank you, we have found a work-around to this problem.