In my index method I render a basic login form, that I sent to my index.scala.html:
/**
* Main entry method for the application
*/
public static Result index() {
return ok(views.html.index.render(form(Application.Login.class)));
}
In the file index.scala.html: I have defined the form parameter:
@(form: Form[Application.Login])
@main(title = "myTitle") {
<h2>Testing app</h2>
}
So, in this file I call the parent template by @main(…). But how to pass the form to my parent template? I have tried the following:
@(form: Form[Application.Login])
@main(title = "myTitle", form) {
<h2>Testing app</h2>
}
and the in my main.scala.html the following:
@(title: String, form: Form[Application.Login])(content: Html)
But this is not working, I get the following error message:
not enough arguments for method apply: (title: java.lang.String, form: play.data.Form[controllers.Application.Login])(content: play.api.templates.Html)play.api.templates.Html in object main. Unspecified value parameter form.
As Julien stated this is working: