Maybe this helps, for a start:
http://docs.jquery.com/Plugins/Validation#Refactoring_rules

Otherwise you could also predefine messages for all inputs (add via
$(...).validate(...)) and only later add rules to individual elements.

If that doesn't help, take a look at the rules-implementation:
http://dev.jquery.com/browser/trunk/plugins/validate/jquery.validate.js#L102
Writing a plugin to add messages should be much simpler, just add
something to validator.settings.messages.

Jörn

On Tue, Jul 8, 2008 at 7:52 PM, Mike <[EMAIL PROTECTED]> wrote:
>
> I really love the validation plugin (http://docs.jquery.com/Plugins/
> Validation/rules#.22add.22rules).  I am using the functionality to add
> a rule for an input one one line.  See below:
>
> $("#myinput").rules("add", {
>  required: true,
>  minlength: 2
> });
>
> I am wondering if there is something equivalent for messages as well.
> Like
>
> $("#myinput").messages("add", {
>  required: "This field is required",
>  minlength: "The field requires a minimum length"
> });
>
> I tried that and it didnt work but I am not sure if there is something
> similar possible.  If not is this something that would be useful to
> others and could be added?  Maybe even a function that combines the
> two like:
>
> $("#myinput").rules("add", {
>  required: {true, "This field is required"},
>  minlength: {2, "This field is need a min length of 2!"}
> });
>
> What do you think?
>

Reply via email to