manish schrieb:
Hi Friends,
I am using CakePHP framework. With that I am using jquery for AJAX
calls to my forms. It works perfect for me. Now I want to use the
jquery for my form fields validations on client side.
I saw a very good plugin at
http://bassistance.de/jquery-plugins/jquery-plugin-validation/
. But I don't know how to use this with AJAX. I already tried
<script>
$(document).ready(function(){
$("#myForm").validate();
});
</script>
This also works. But When I implement this with my existing project
using AJAX. It does not work.
For AJAX my jquery function is called at onSubmit event of myForm as
$.ajax({url: "../EmployeeDetails/employee_details_edit/", data: $
(this.elements).serialize(), success: function(response){$
("#sub1content").html(response);}, type: "Post", dataType: "html"});$
().ajaxSend(function(r,s){ $("#contentLoading").show() });$
().ajaxStop(function(r,s){ $("#contentLoading").fadeOut("fast") });
return false;
But I don't know how to fit my Validate call into this form submit
call.
Any help would be greatly appreciated.
Take a look at the submitHandler option here:
http://docs.jquery.com/Plugins/Validation/validate
There is also an example for using the form plugin in combination with
validation (also using the submitHanlder):
http://jquery.bassistance.de/validate/demo/ajaxSubmit-intergration-demo.html
Jörn