Fast tabbing out of ajax validated form fields

Hi all,

I have a form that uses ajax validation to display error messages. This form has 2 input fields next to each other (A and B ). A and B both have ‘required’ validation rules set on them and B also has a minimum integer value of “10” set. I am finding that if I enter ‘12’ into A, then very quickly tab into B, enter ‘12’, and then very quickly tab out of B, the state of the form when it hits the server for the ajax validation contains ‘12’ for A and ‘1’ for B (presumably because the validation request is being send halfway through the editing of field B ). This is causing B to have its error message displayed when the entered value is actually valid. Has anyone else experienced anything like this?

Yes, when I use onKeyUp as the event to trigger validation.

Were you able to find a way to prevent this from happening?

No, but you could consider using onChange instead.

I think onChange is the default that I was using. I managed to fix this issue by increasing the validation delay on the CActiveForm.

Thanks!

This probably isn’t the solution you were looking for but maybe validating on submit would work better?