Sure there have been all kinds of whacky plug-ins over the years aimed at achieving this, but never a single standard that we could work towards.For a more detailed introduction to HTML5 form validation you can find some great articles linked under References below.
When you are asking a reader for their email address, you can use a simple » address validation function to make sure the address has a valid structure. Each option in a drop-down box is indexed in the array Annoyingly, there is no simple way to check which radio button out of a group is selected — you have to check through each element, linked with Boolean AND operators .
Also each browser has a slightly different default behaviour.
The simplest change you can make to your forms is to mark a text input field as 'required': This informs the (HTML5-aware) web browser that the field is to be considered mandatory.
Again, not very helpful, but it will stop people trying to input their email address or other such nonsense. Careful examination of the RFCs associated with email addresses has been conducted repeatedly and has been proven to require the use of recursion in order properly determine the validity of an email address using the full set of RFC specifications.
As mentioned above, we can improve on this by making use of the are already implicit so the input has to match the entire expression. If anyone wants to contribute a more thorough expression to test for valid email or url format, feel free to post it using the Feedback option above.. Since it is not possible to recurse when using a regular expression it is also not possible to create a truly accurate regex for doing email address validation.