Tutorials

Books

Handling form submission

Defining a form

The play.data package contains several helpers to handle HTTP form data submission and validation. The easiest way to handle a form submission is to define a play.data.Form that wraps an existing class:

Filling a form with initial default values

Sometimes you’ll want to fill a form with existing values, typically for editing:

userForm.fill(new User("bob@gmail.com", "secret"))

Register a custom DataBinder

In case you want to define a mapping from a custom object to a form field string and vice versa you need to register a new Formatter for this object.For an object like JodaTime’s LocalTime it could look like this: