...
When rendering, the Form component emits two notifications: first, "prepareForRender", then "prepare". These allow the Form's container to setup any fields or properties that will be referenced in the form. For example, this is a good chance place to create a temporary entity object to be rendered, or to load an entity from a database to be edited.
...
Because of the the fact that a form submission is two requests (the submission itself, then a re-render of the page), it is necessary to make the value stored in the _ userName field persist between the two requests. This would be necessary for the _ password field as well, except that the PasswordField component never renders a value.
...
The Form only emits a "success" event if the there are no prior validation errors. This means it is not necessary to write if (_form.getHasErrors()) return;
as the first line of the method.
...