Lord AlexG
Lord AlexG

Reputation: 13

I can't fill a form in play framework java

I followed the documentation of Play with JavaForms in https://www.playframework.com/documentation/2.3.4/JavaForms but I can't fill my form. I have this in my controller:

 public class UserController extends Controller 
 {
      private static final Form<User> userForm = Form.form(User.class);
      ...

      public static Result updateUser(String idUser)
      {
           User user = new User();
           UsuarioEktorp us = crud.getUsuario(idUser);
           ...
           user = us.getSomething();
           ...
           Form<User> filledForm = userForm.filled(user);

           return ok(ViewUser.render("Update user", filledForm));
      }
      ...

And in my view:

 @(title: String, userForm: Form[User])

I use couchDB for database, and for that I use ektorp classes. The thing is that I can save users with this form. The problem begins when I try to fill the form, I thought perhaps the user was empty but I iterated it and I could display its data in the console.

Upvotes: 0

Views: 483

Answers (1)

Cl&#233;ment Poissonnier
Cl&#233;ment Poissonnier

Reputation: 1409

The correct instruction should be

Form<User> filledForm = userForm.fill(user);

and not

Form<User> filledForm = userForm.filled(user);

Is it ok for you?

Upvotes: 1

Related Questions