I want to run two validation check on some of the fields like for username email.
I want to check their uniqueness (availability) from server using .ajax() and also to validate them if the field is empty or the entered data is not acceptable like(email: foo@hu).
What i have done is seprated the two checks as follows :
the ajax uniqueness (availability) check is set for the keyup event ;
and the validation check of required field is due till the submit.
Pretty much accomplished the above two thing except the preventDefault action of the submit button if the span errors are present due to "ajax" check.
here is my js
here in the above code the check for if any error before submission has a condition
which i included to check for the error of unique class generated due to the ajax calls.
but what i do is if the username is available i place a checkmark and "Available" message displayed which though is not a error but prevent my form submission .
So my questions are:
1.i want to know how can i allow submit if the error is due to the checkmark "available".?
2.Rather than checking for validation after submit, how can i accomplish it after the event blur from that field.means doing the two checks simultaneously on input field.
3.i have copied the same code thrice in the script for ajax checking uniqueness for three fields.Can i combine them into one?.or am i asking too much because the message displayed is different every time.
4.ajaxCompletet is not responding that's why i commented it out.Also after doin that my code is working the only problem the firebug console shows in the XML field is "Parsing error syntax location"what is that.?
Sorry for such a long post but after lots of lots of googling i end up finally asking here.
Thanks for patience