0

Using Play 2.1 Java version

I have a simple form

 <div class="row">
    <div class="col-md-6">
        @inputText(userForm("usercode"), args = 'placeholder -> "User Code",'class -> "form-control input-sm",'_label -> "User Code")
    </div>
    <div class="col-md-6">
        @inputText(userForm("username"), args = 'placeholder -> "User Name",'class -> "form-control input-sm",'_label -> "User Name")
    </div>

When the User submits the Form and if Errors Exists the Form inputted data is lost.

At my controller

 Form<User> userForm= Form.form(User.class).bindFromRequest();
  if (userForm.hasErrors()) {
            Logger.info("Erros in Form");
            return badRequest(
                    userAdd.render("Add User",userForm)
            );
    }

Question :

How to retrieve the values back to the form ?

Thanks

Suave Nti
  • 3,721
  • 11
  • 54
  • 78

1 Answers1

-1

You need to pass the form to the view again as a common templates param.

biesior
  • 55,576
  • 10
  • 125
  • 182