Take a look at the following link, you will see I have a simple form with various fields that are required. I have put together a small script to validate entry before submission. Normally the random numbers are generated using php but for the example I have just added them manually.
The solution does seem to work but I would prefer as one input is completed the error would disappear. Currently this works for the standard inputs that just require some kind of entry but doesn’t work when an input requires a valid email or sum. If a correct email is entered, but the verify question hasn’t been entered the error still appears on the email field.
http://jsfiddle.net/marcsanders/xgZeV/
Any help much appreciated!
Try the following:
Updated jsFiddle here.
You may also consider using a html5
requiredattribute on elements that are required, rather than using javascript.