[jQuery] Re: [Validate plugin] Question about the 'remote' AJAX option

2009-07-09 Thread Guillaume Lecanu

On Jul 8, 6:31 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 The JSON response can be true/false, or a String, handled as false
 (invalid), and the string will be used as the error message. You need
 the latest version (1.5.5) for that to work properly.

Perfect !
Thanks



[jQuery] [Validate] How to disable onkeyup checks on a specific field ?

2009-07-09 Thread Guillaume Lecanu

Hello,

I have a field that use the 'remote' option to call a server side
script to check the field value.

If the field value is wrong, after each new key pressed, the remote
server side is called.
This could be very ennoying and increase the load on our server.

There is a way to disable the onkeyup event only for a specific
field ?

I have tried :
jQuery.validator.setDefaults({
myField: {
 onkeyup: false,
 remote:   'myScript.php',
}
});
And also tried :
jQuery.validator.setDefaults({
myField: {
 remote:   'myScript.php',
},
onkeyup: {
  myField: false
}
});
but this doesn't works...


Thanks in advance for your advices.



[jQuery] Re: How to disable onkeyup checks on a specific field ?

2009-07-09 Thread Guillaume Lecanu

I have found the solution :

jQuery.validator.setDefaults({
onkeyup: function(element) {
if (element.name == 'myField') {
return true;
}
if ( element.name in this.submitted || element ==
this.lastElement ) {
this.element(element);
}
}
}

If this can help ;-)


[jQuery] [Validate plugin] Question about the 'remote' AJAX option

2009-07-08 Thread Guillaume Lecanu

Hi,

I trying to replace my old AJAX system by the Validate plugin of
jQuery with the remote option.

There is a way to return a custom error message directly from the
server side script ?

For example, I have a username.php server side script that check :
- If the username is not used by someone else
- If the username doesn't contains any bad words

So, the error message could be different.


If not, the only solution I see is to create special rules that
explicitly uses $.ajax() but this mean this will do 2 AJAX calls on
this page... it's not the best solution.


Thanks in advance for your advices !