4

I'm new to form validation and I have been lucky over the years. I would like to update my method of form creation in my sites. I was curious to know what is standard and if there is a preexisting solution to my needs? My goal this week is to learn how to validate an email address and check for spam.

I can create forms in HTML5 without issues but I don't know if JavaScript form validation with PHP form validation is standard. I did run across this from my searches and appears to be a good start, but I want to know more.

3

The linked article is from 2009. Since then some improvements have been made in regards to form validation. One being that HTML 5 already has built-in form validation, but fails in older browsers with no HTML 5 support.

Of course there are javascript libraries which helps you with the validation part like:

Parsley.js (Javascript) or
jQuery Validation Engine (Javascript) or
Validation (PHP)

I suggest you take a look on the different implementation methods and what you can do with them.

For Spam checking, well, that's another story. There aren't very good standalone libraries which are any good (at least not in my experience). Of course, you could always go with integrating the pretty awesome Akismet to detect spam after form submission or integrate some third-party services like reCAPTCHA.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.