the form mapping, which describes all form fields
the current form data, used to display the form
the collection of errors associated with this form
a concrete value of type T
if the form submission was successful
Retrieves a field.
Retrieves a field.
For example:
val usernameField = userForm("username")
the field name
the field, returned even if the field does not exist
Binds data to this form, i.e.
Binds data to this form, i.e. handles form submission.
Json data to submit
a copy of this form, filled with the new data
Binds data to this form, i.e.
Binds data to this form, i.e. handles form submission.
the data to submit
a copy of this form, filled with the new data
Binds request data to this form, i.e.
Binds request data to this form, i.e. handles form submission.
a copy of this form filled with the new data
Constraints associated with this form, indexed by field name.
the current form data, used to display the form
Discards this form’s errors
Discards this form’s errors
a copy of this form without errors
Retrieve the first error for this key.
Retrieve the first error for this key.
field name.
Retrieve all errors for this key.
Retrieve all errors for this key.
field name.
the collection of errors associated with this form
Returns the form errors serialized as Json.
Fills this form with a existing value, used for edit forms.
Fills this form with a existing value, used for edit forms.
an existing value of type T
, used to fill this form
a copy of this form filled with the new data
Fills this form with a existing value, and performs a validation.
Fills this form with a existing value, and performs a validation.
an existing value of type T
, used to fill this form
a copy of this form filled with the new data
Handles form results.
Handles form results. Either the form has errors, or the submission was a success and a concrete value is available.
For example:
anyForm.bindFromRequest().fold( f => redisplayForm(f), t => handleValidFormSubmission(t) )
common result type
a function to handle forms with errors
a function to handle form submission success
a result R
.
Applies a function for a field.
Applies a function for a field.
For example:
userForm.forField("username") { field => <input type="text" name={field.name} value={field.value.getOrElse("")} /> }
result type
field name
field handler (transform the field to R
)
Formats associated to this form, indexed by field name.
Formats associated to this form, indexed by field name. *
Returns the concrete value, if the submission was a success.
Returns the concrete value, if the submission was a success.
Note that this method fails with an Exception if this form has errors.
Retrieves the first global error, if it exists, i.e.
Retrieves the first global error, if it exists, i.e. an error without any key.
an error
Retrieves all global errors, i.e.
Retrieves all global errors, i.e. errors without a key.
all global errors
Returns true
if there is an error related to this form.
Returns true
if there is a global error related to this form.
the form mapping, which describes all form fields
a concrete value of type T
if the form submission was successful
Convenient overloaded method adding an error to this form
Convenient overloaded method adding an error to this form
Key of the field having the error
Error message
Error message arguments
a copy of this form with the added error
Adds an error to this form
Adds an error to this form
Error to add
a copy of this form with the added error
Adds a global error to this form
Adds a global error to this form
Error message
Error message arguments
a copy of this form with the added global error
Helper to manage HTML form description, submission and validation.
For example, a form handling a
User
case class submission:the type managed by this form
the form mapping, which describes all form fields
the current form data, used to display the form
the collection of errors associated with this form
a concrete value of type
T
if the form submission was successful