HighDots Forums  

(validate) validation (plugin) remote message optionproblem.

jQuery jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript.


Discuss (validate) validation (plugin) remote message optionproblem. in the jQuery forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
adwen
 
Posts: n/a

Default (validate) validation (plugin) remote message optionproblem. - 11-03-2009 , 07:21 AM






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 With Quote
  #2  
Old   
Nemezya
 
Posts: n/a

Default Re: (validate) validation (plugin) remote message optionproblem. - 11-04-2009 , 07:19 AM






Hi,

I don't know if it can help but i had a quite similar problem.
The function associated to my remote test was triggered whatever the
server response because of a bad json encoding for the true/false
response.
I used json_encode() and it works now.

Reply With Quote
  #3  
Old   
adwen
 
Posts: n/a

Default Re: (validate) validation (plugin) remote message optionproblem. - 11-05-2009 , 06:59 AM



Hi,

Thnx for the reply!

I'm programming in ASP.NET (mvc) so we do not have the 'json_encode()'
function. What we actually do have is this 'Json()' method to properly
format the response into JSON. When I don't use a custom message (and
only use (un)highlight to color the textfield borders to Red) it works
GREAT! So I assume that it is getting the response (which is either
'true' or 'false') correctly. I don't know if validation plugin
(1.5.5) see a difference between a string or a boolean. Maybe it is
getting a string and it is expecting a boolean. I don't know what is
going wrong here and i do not know how to debug the validation plugin.

I find it weird too that I'm not getting any reaction from the plugin
creator(Jörn) or from someone else who is actively involved with the
development of this plugin.

But once more thnx for the reply! keep them coming! Any suggestion
that might help is appreciated!

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.