How to Reset login form

Hello guys,

First of all Merry Christmas to all and wish you all the best for the new year.

I’d like to know how to programatically reset the user and pass values in the login form. For example when the user is not allowed to login, I process the login event and then would like to clear the form. I did not find API for this. Please advise.
Thanks in advance!

Hello guys,
I found some way to reset the login form from my vaadin java code:


Looks nasty, but works perfectly B), what bothers me is that the iframe name PID7 could change and the code will stop working. So my question is where does this name come from? Is there a way to set it explicitely?

Kind regards,

Indeed, this is ugly and fragile, but the LoginForm component seems to lack the API for this. You could
create an enhancement request
to add such API.

As for alternatives, you could e.g. consider replacing the whole LoginForm instance with a new one, or override getLoginHTML() to make this easier to do in JavaScript.

If you don’t care about the browser remembering previously entered user names and passwords, you can also create the login form yourself with standard components without using the LoginForm component.

The id PID7 comes is automatically generated and can be different on the next run if the layout around the component changes. If you set the debug ID for a component (the login form), “PID_S”+debugId is used instead of a generated PID.

Unfortunately when I set the debug ID for the loginForm it changes only the id of the corresponding div surrounding the iframe. The ID and name of the iframe stays the same automatically generated value. Did anyone manage to solve this issue?

For Vaadin 6 I could not find a solution to set a stable id or name of the iframe. However I solved the password reset task via javascript:

for (var i=0; i<window.frames.length; i++) {
  var frame = window.frames[i]
  var passwordField = frame.document.getElementsByName('password')[0]
  if (passwordField) {
    passwordField.value = "";

BTW since the addon does/did not work in all browsers there was a discussion about to deprecate it and a fixed version has been posted on:

Hi, how could i set the name of iframe. It is really important for me. I use Vaadin 7.1.0

I’m not certain if that would work, but if it does, the easiest option would probably be to write a little
JavaScript Extension
that sets the name. It seems to me that the current version of Vaadin might not depend on the specific name currently used, although I might be wrong and this could change in the future.

If it does not work, you might need to customize the client side classes used.