Skip to content

Commit

Permalink
Add note about boxed validators to README.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadowfiend committed Nov 14, 2016
1 parent bc37363 commit 5b28513
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ A basic form snippet would look like this:
// Assuming a case class User(name: String, age: Int, phoneNumber: String, termsAndConditions: Boolean).
User(name, age, phoneNumber, termsAndConditions).save
}

"form" #> registrationForm.binder
```

Expand Down Expand Up @@ -142,6 +142,15 @@ the set of validations that are supported by
[Parsley.js](http://parsleyjs.org). These will have matching server-side
validation implementations.
In certain very specific cases, it can be useful to run a validation even
if the value in question isn't actually submitted in the form. Typically
this is used for a check that a required field was submitted, particularly
when it comes from a checkbox or radio button. Either way, in these cases
a validation can take a `Box[T]` instead of `T`. It will receive an `Empty`
if the field is not submitted, and a `Full` with the deserialized value if
the field is submitted. Lift-formality's own `notBlank`/`notEmpty` validators
will correctly handle unsubmitted fields.
### Event handling
Formality can also add server-side event handlers to form inputs:
Expand Down

0 comments on commit 5b28513

Please sign in to comment.