Remove required from Vaadin LoginForm inputs

Hi, is it possible to remove the required from the username and password input fields in the LoginForm? So the text field doesn’t become red and there is no dot next to the Username and Password label.

Thanks in advance

It’s not possible because both fields are by design required in a login. You can create your own form if the default component doesn’t fulfill your requirements.

The folks at Vaadin suggested I do something like this.

    public void setRequiredIndicator(boolean required) {
        String js = "this.$.vaadinLoginUsername.required={0}; this.$.vaadinLoginPassword.required={0};";
        getElement().executeJs(MessageFormat.format(js, required));

Works for now

As a general advice, you should avoid using string concatenation for executeJs and use parameters instead, for security reasons

Good observation, I will change that :+1: