Hi,

I have this horrible problem that i've spent like 2 days looking for a
easy solution but to no avail. I've been using the jQuery validation
plugin to do the validation for me and it has working great so far.
I've added the remote option and it communicates perfectly with the
server and sends the responde back to the user.

I don't know it is a bug or that is the way the author intended for it
to work but if there is a problem with the remote validation. I've
made an function that should be triggered and send a 'callout' to the
field. I add this function for the remote in the message section in
'rules'. This should ONLY happen when the field is validated as
false.

For some reason the second i press on submit it doesn't matter the
outcome of the remote validation. it simply executes my function at
all times.

My code:

 $(document).ready(function() {
         $("#form").validate({
             errorClass: "errorClass",
             ignoreTitle: true,
             errorPlacement: function(error, element) { },
             rules: {
                 Name: {
                     required: true,
                     minlength: 2,
                     remote: {
                         url: '<%= Url.Action("VerifyName")%>',
                         type: 'POST',
                         dataType: 'json',
                         data: {
                             Name: function() {
                                 return $('#Name').val();
                             },
                             Id: function() {
                                 return selectedID;
                             }
                         }
                     }
                 },
                 Category: {
                     required: true,
                     minlength: 1,
                     digits: true
                 },
                Country: { required: true }

             },
             messages: {
                 Name: {
                     required: "",
                     minlength: "",
                     remote:  function(element) {
                         //alert("hello")
                         showCallOut("Name", 'This name already
exists');
                     }
                 },
                 Category: ""
             },
             focusInvalid: false,
             onkeyup: false,
             onfocusout: false,
             highlight: function(element, errorClass) {
                 $(element).addClass(errorClass);

             },
             unhighlight: function(element, errorClass) {
                 $(element).removeClass(errorClass);

             }
         });

     });

What can i do to solve this issue?  Is this a bug in validation
plugin? How do I contact the owner of the validation plugin?
I've read a thread with the similar problem but the solution doesn't
work in my situation:

http://groups.google.com/group/jquery-en/browse_thread/thread/45ce7e9f59979b67/089e0b018e79da5a?#089e0b018e79da5a

Reply via email to