JavaScript can be used to evaluate an user's inputs into a form on a HTML webpage. The adventage of using JavaScript to evaluate a form mainly lays in fact that the code being executed on client's machine is reliable, practical and very fast to execute. In the example below we will see a simple REGEX way of evaluting a few form fields only with the JavaScript code.

NOTE: JavaScript also introduces some safety vulnerabilities so it is a better way to evaluate and sanitize form data with combining JavaScript, with PHP form evaluation and HTML5 new input types.

Example of a simple form evaluation with e-mail check in JavaScript

 

›› go to examples ››