login - set form values

There is any way to use some pre set values in Vaadin Login Form?
In Forms that uses texfields and other component’s usually goes with .setValue(value), like:

textField.setValue("text");```

But for Login Form there are no components but Strings for the labels
![unknown.png|1087x248](upload://ggnhGiuO7HR3SshHuf95tTUrMet.png)

just to clarify, I want default values user/user (for username/password), so the “guest” can log in without knowing the password but having only user rights.

Unfortunately, there is no API for that

ok! thx

You can use JavaScript

UI.getCurrent().getPage().executeJs("document.getElementById('vaadinLoginUsername').value = 'value';");

The password field of vaadinLoginPassword

Here’s another workaround I got from the team:

LoginForm loginForm = new LoginForm();
loginForm.getElement().executeJs("this.$.vaadinLoginUsername.value = $0;", "admin@domain.com");
loginForm.getElement().executeJs("this.$.vaadinLoginPassword.value = $0;", "supersecretpassword1");

okk!! thx gonna try that one !!

it works :D! thx a lot

Now there are two cookbook recipes on solving the issue Vaadin Cookbook - code snippets for common tasks

Thanks for bringing this up!