O'Reilly logo

Lift Application Development Cookbook by Gilberto T. Garcia Jr.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Validating forms

In the previous recipe, we learned how to create a form so that users can submit data to the server. However, we didn't validate the data, and thus, it allows users to submit anything including invalid data, such as an invalid e-mail address or date.

The reason to validate data submitted by users is not only to prevent the application crashing from being fed data in an invalid format—for example, sending an email to an invalid e-mail address—but also for security reasons.

Getting ready

We are going to improve the code from the previous recipe by adding validation to the form we've created. You can duplicate the project to keep the previous section's code unmodified or you can modify it.

How to do it...

Carry out the following steps ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required