Control LoginForm overly-eager validation error messages

Our app uses a standard LoginForm. The containing view also contains an anchor to a signup page. Everything works great, EXCEPT that when a user clicks this anchor, the LoginForm’s validation error messages display (“Username is Required”). This is a visual nuisance, and sometimes the user has to click on the anchor twice. We only want the validation error messages to display when the user clicks the Login button, i.e., only when a POST to /login is made.

Thoughts? Hoping this is an easy one :slight_smile:

Sounds like you have auto-focus enabled; if you disable it it should work.

loginForm.getElement().setAttribute(“no-autofocus”, “”);

@knoobie , yep that did the trick… many thanks! Is there documentation on that attribute that you’d recommend?

It’s mentioned in the JSDocs of the component: Vaadin web components

Additionally it’s also used in all examples in the docs (you can see it if you expand the code snippets)