In HTML5, form Input fields have three built-in forms of validation;
The input type
The required status
Regex validation patterns
Input type
The input type indicates the type of data expected, and is a good first-line-of-defense. On some browsers- particularly mobile browsers- it will also change the UI/UX of that input to work best for that device.
Required status
Indicates whether the form can be submitted with the field left blank.
Regex validation patterns
Offers a much more complex pattern-matching approach. Regex syntax is very picky and can be difficult to code and debug, but a good regex is hugely helpful in validating your inputs.
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.