quite an odd little problem that I am getting on this simple form field validation script.
I have 3 fields, 1 text input for name, 1 email input and 1 textarea for the comment.
Basically what happens now is that if you leave any field out and hit submit I assign either a .error
or .valid
class to the proper dom object.
The odd thing is however that if you miss out on one of the fields such as skip the name field, fill out the others, hit submit and then try to fill the name in, the validation even though it recognizes the field value as passing the regex (/.+/gi
) it will apply the error class as it marks the field as failed
.
Any ideas on what I am doing wrong would be much appreciated.
Code example is up on JS Fiddle: http://jsfiddle.net/jannis/YXfZN/
Note: This bug is happening and reproduced in the linked Fiddle in Chrome on Mac (v 12.0.742.112).
Thanks for taking a look, I look forward to your ideas and suggestions.
Jannis