On 2/10/07, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:
No, only one message per field can be defined. But that is a limitation
that seems to provide better usability anyway: It can be quite
frustrating to enter a value, get an error message, correct the value,
and getting a different error message. I think the better approach tells
the user what it expects with one message.
In that case, I agree that rangeLength would have been a better option, but
how about this:
$("#myform").validate({
rules: {
firstname: { required: true },
age: { number: true },
password: { rangeLength: [5, 32] },
email: {required: true, email: true}
},
messages {
password: {
rangeLength: "Please enter a password greater than {0} and less
then {1} characters long",
},
email: {
required: "Please enter your email address",
email: "Your email address is not correctly formatted. It should
look like [EMAIL PROTECTED]"
}
});
With the email field, not entering anything and entering something that is
not properly formatted are two completely different errors IMO, and thus
deserve two different error messages describing exactly why the user's input
was not accepted.
Absolutely! The long-time goal of this library was to create a
serverside setup that generates the client-side rules based on the rules
checked on the serverside, so you don't have to duplicate them, just
what mentioned.
Please let me know when you implemented something, it would be great to
have some examples to do that in different languages.
I'll be sure to email the list when I have something in that area (the
wrapper I mentioned will most likely have to do some reconciling between my
rule names and yours). In the meantime, I would greatly appreciate feedback
on what's already there. The project is available at
http://aheimlich.freepgs.com/projects/php/hvalidator
--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/