Validating form data

A few months ago Sandeep introduced us to the HTML Constraint API, showing how we can use the new HTML5 input types and attributes to validate our forms in the browser with minimal Java Script.Today I’m going to walk you through validating a simple booking form by using the Constraint API, and keep an eye on how you can make sure your forms stay accessible too.

validating form data-22validating form data-57

Validate qty of checkboxes in a group (same name) have been checked, using min, max or range.

With more and more personal information being stored on the Web—credit card data, social security numbers, maiden names, favorite pets—today's PHP developer cannot afford to be ignorant when it comes to security.

Sadly, most beginning programmers fail to understand the truth about security: there is no such thing as "secure" or "insecure." The wise programmer knows that the real question is a site is.

Server-side validation is enough to have a successful and secure form validation.

For better user experience, however, you might consider using client-side validation.

Strictly speaking, you should make sure you're using the HTML5 DOCTYPE, otherwise you'll run into HTML validation errors.

You must have an account to comment. Please register or login here!