Drupal 7 validating form on ajax
You can use AJAX to post various data parts to the server.
The form submit's ajax function still just calls the callback function directly, bypassing validation, submit, and also making it so the button cannot be clicked multiple times. I literally copied and pasted Joshua Stewardson code and it did not work.I am unable to submit the form when blur event fires but when i click submit button it is submitting form and validating textbox but page refreshing.I used ajax form module in my site its working fine without page refresh but when i click submit button to get same functionality when i fire blur,onfocus...events.. If the name isn't valid, or we need to display some sort of error message, we append this to the description, or you could just define a new div to place stuff into. You need to create a modulename directory in sites/all/modules then inside that directory create 2 files modulename.module and with a little bit of information about your module. Now open up your .module file and let's create the url.What this does is creates a path for the validation (modulename/validate) and then calls a function (there's nothing special about this function name, you could have called it foo_validateme) passing it the string parameter parameter.
Search for drupal 7 validating form on ajax:
Another reader commented that it would be a great idea to use the same validation function name so that the form would be validated by the same code using Ajax or just normal form submission.