0

I have a registration form with the following data:

First Name Last Name Age Email address Tel Number password re enter password.

Now if the passwords dont match or the age is a text error messages are show, i have a reset button to clear all the fields, but after the error comes up the resent button doesnt clear the messages or the fields.

Here is the code for the Button and whats in my java class:

<h:commandButton value="Reset" type="reset" action="#{javaBeanTest.reset()} />

In the Bean Class:

public void reset()
{
    this.foreName = null;
    this.surname = null;
    this.age = 0;
    this.password = null;
    this.confirmPass = null;
    this.email = null;
}

How would i go about this? The Fields gets set to blank but messages remain

braX
  • 11,506
  • 5
  • 20
  • 33
user3506349
  • 9
  • 1
  • 7

1 Answers1

0

Try to use render="@form" in your command button, it will update the form and errors in it. What are you using for showing errormessages?

Try this way:

<h:commandButton value="Reset" action="#{javaBeanTest.reset()} />    
    <f:ajax render="@form"/>
</h:commandButton>
Qussay Najjar
  • 561
  • 3
  • 7
rustemk
  • 86
  • 1
  • 9