Yes, thats possible. Something like this works: $.validator.addMethod("custom", function(value, element) { if (invalid(value) { this.settings.messages[element.name] = "my custom message"; return false; } return true; }, "default message");
That works best when you have only that custom method as a rule. Mixing it with other methods gets a bit more complicated, you have to assign the custom message to messages[element.name].custom, and check first messages[element.name] is defined. Jörn On Fri, Aug 22, 2008 at 4:17 AM, shapper <[EMAIL PROTECTED]> wrote: > > Hi Jörn, > > It worked fine ... just a suggestion: > > What about the custom method to return the error message? > > This way a value could be checked in many ways and displaying a more > accurate message for each error. > > Is this possible? > > Thanks, > Miguel > > On Aug 21, 9:39 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]> > wrote: >> Custom remote methods are currently not supported. You'd need to >> replicate the current implementation and change the necessary details >> - not recommended. >> >> There are various options for customizing message display, but using >> animations isn't supported either. You could give the >> highlight/unhighlight and showErrors options a try. In any case you'd >> have to familarize yourself with the validation plugin a lot, its way >> beyond what I can help with on this list. >> >> Jörn >> >> On Thu, Aug 21, 2008 at 10:07 PM, linocarvalho <[EMAIL PROTECTED]> wrote: >> >> > Hello, >> >> > I have one more question about this, >> > I want to know if could override the default remote function creating >> > another function that calls a $.ajax with method POST and has effects >> > fadeIn() and fadeOut() when validating a INPUT. >> >> > For example: >> > remote: function(value, element, >> > param) { >> > $.ajax({ >> > type: "POST", >> > url: "/sys/check- >> > email.php", >> > dataType: "json", >> > data: "email=" + $ >> > ("#EMAIL").val(), >> > beforeSend: function() >> > { >> > $("#load- >> > email").fadeIn(); >> > }, >> > success: >> > function(result) { >> > $("#load- >> > email").fadeOut(); >> > return result; >> > } >> > ); >> >> > But this function is not working how I expect. The effects works >> > properly but I can still submit the form if the e-mail is not valid. >> >> > Any suggestions is welcome. >> >> > Thanks, >> > Lino >> >> > On 21 ago, 15:19, "Jörn Zaefferer" <[EMAIL PROTECTED]> >> > wrote: >> >> Yes, seehttp://docs.jquery.com/Plugins/Validation/Methods/remote#url >> >> >> Jörn >> >> >> On Thu, Aug 21, 2008 at 6:48 PM, shapper <[EMAIL PROTECTED]> wrote: >> >> >> > Hello, >> >> >> > Can I validate a input using a remote function on my server side code? >> >> >> > I could return a JSon from my server side code with "True" or >> >> > "False" ... >> >> >> > Could someone tell me how should I do this? >> >> >> > Thanks, >> >> > Miguel- Ocultar texto entre aspas - >> >> >> - Mostrar texto entre aspas - >