I am learning about play 2.0 and I have got a question on the form helpers.
For me it all comes down to what benefit is it actually giving by using it in the templates? Am I using it correctly?
First: using the form helper:
@form(action = routes.Application.addAccount("blank")) {
@inputText(accountForm("id"))
<input type="submit" name="action" value="submit ID"/><br />
}
Why is that better then just defining
Enter your id "<input type="text" name="id"/>"
I know I can use the form model to help with validation on the server side. - that's where I see the great benefits of form helper. But where does it help to actually include the form in the Scala template? Can i use the form helper to automatically generate useful things in the html like client side validation, etc?
Cheers
it helps you generate a lot more than just tags. From the documentation:
and
(http://www.playframework.com/documentation/2.2.x/JavaFormHelpers)
So instead of
you have just one readable line
EDIT: It will also read constraints on your java beans, e.g
and use html5 browser validations and display the coinstraints to the user. (http://www.playframework.com/documentation/2.2.x/JavaForms)