12 Validating Forms

CoffeeRun is humming along! Users can enter coffee orders in the form, and the order information is processed and stored. But what would happen to your app – and your coffee truck – if someone submitted an order with missing or unusable information?

Not to worry. You can easily handle these scenarios with a little bit of code to make sure the data is OK for your application to use. In fact, this is an essential step if you ever send data back to a server. Almost every modern browser is prepared to validate form data when it is submitted. All you need to do is provide the rules.

In this chapter, you are going to learn two techniques for form validation. The first technique is to add validation attributes to ...

Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.