I’m trying to show a form with the values but it’s not working.
my action:
public static Result login() {
User user = new User();
user.name = "Murilo";
Form<User> userForm = form(User.class);
return ok(login.render(userForm.fill(user)));
}
and my html:
@(myForm : play.data.Form[models.User])
<!DOCTYPE html>
<html>
<head>
</head>
<body>
@helper.inputText(myForm("name"))
</body>
</html>
but when I access it, the following error throws:
type mismatch; found : play.data.Form.Field required: play.api.data.Field
As a addition to nico_ekito‘s good answer: I usually do not use
@helper..because it is long and not/less readable if your form starts to grow (more fields). So I do the following: