Great! I've added the example to the documentation here:
http://docs.jquery.com/Plugins/Validation#Refactoring_rules
Thanks!! Worked great =)
On Jun 24, 1:35 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]>
wrote:
> How about this:
>
> $.validator.addMethod("customerRequired",
> $.validator.methods.required, "Fyll i");
> $.validator.addMethod("customerMinlength", function(value, element) {
> return $.validator.method
How about this:
$.validator.addMethod("customerRequired",
$.validator.methods.required, "Fyll i");
$.validator.addMethod("customerMinlength", function(value, element) {
return $.validator.methods.minlength.call(this, value, element, 2);
}, "Förnamnet måste vara minst 2 tecken");
Then either ad
Hmm, I don't quite understand how to implement this.
Let's say that i have this now:
rules:
customer:{
required:true,
minlength:2
}
messages:
customer:{
required:"Fyll i",
minlength:"Förnamnet måste vara minst 2 tecken"
}
How do i convert this to the addMethod functionality, and how to i use
i
You could add a custom method that uses the required-implementation,
but provides a different default message:
jQuery.validator.addMethod("customer",
jQuery.validator.methods.required, "Välj om du är kund hos Avanza
eller ej");
Please let me know if that works for you, the idea is interesting
en
Ahh, that could be something. But what about the messages?
I can have an unknow number of customer fields in my form and I can't
add lets say a hundred messages that looks exactly the same just to be
sure.
Something similair to addClassRules (addClassMessages?) would be
awsome. Is there no other w
One option would to use addClassRules
(http://docs.jquery.com/Plugins/Validation/Validator/addClassRules#namerules)
to create a composite rule, then apply that class to all customer
fields. You'd still need to provide the messages - you could set it as
the default via $.validator.messages.required
7 matches
Mail list logo