Building on our experience from the previous recipe, we want to discuss how we can validate input and present any error messages to the user.
You have your form ready now, ready to be filled with user input.
And because we are good developers we need to make our application, and specifically the handling of user input, robust, because some users will try to break your application by consciously entering invalid data.
The example markup for the validated form is in
validated-form.html, and the snippet lives in
Let's start by adding the
Msg snippet to our form to provide a way to output Lift messages on the page:
<p> <label for="legs">Legs:</label><br> <input id="legs" name="legs"> ...