Sorry for the spam, fixing the subject

On Sep 15, 12:39 pm, Dr Stevens <daverstev...@gmail.com> wrote:
> Thanks for your help.  You always seem to be very quick to respond and
> I, along with everyone else I'm sure, am very appreciative.
>
> Great plugin!
>
> On Sep 15, 12:35 pm, Jörn Zaefferer <joern.zaeffe...@googlemail.com>
> wrote:
>
> > You shouldn't use "visible-required" as the method name. Stick with a
> > valid JavaScript identifier (probably should have mentioned that).
>
> > As long as you do that, you can use addMethod to alias existing
> > methods with other default messages. On the other hand, addClassRules
> > doesn't help at all with messages.
>
> > Jörn
>
> > On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens <daverstev...@gmail.com> wrote:
>
> > > I'm using the validate plugin to validate ASP.NET webforms on the
> > > client (I'd prefer to not use webforms, but for now I'm stuck with
> > > it).  Because I'm using webforms, I'm trying to get around using the
> > > clientID of server controls.  The metadata plugin works great, but I'd
> > > prefer to not use it because it's gonna blow up my markup.
>
> > > Is there any way to utilize jQuery.validator.addClassRules to add
> > > custom messages to a rule?  Take the following for instance:
>
> > > jQuery.validator.addMethod("visible-required", function(value,
> > > element) {
> > >    return $(element).is(":hidden") || !this.optional(element);
> > > }, "This is required when visible");
>
> > > jQuery.validator.addClassRules("fool", {
> > >    visible-required: true,
> > >    lettersonly: true,
> > >    messages: {
> > >        visible-required: "My specific field must is required",
> > >        lettersonly: "Letters only fool!"
> > >    }
> > > });
>
> > > On a slightly related note, is there any overhead associated with
> > > adding custom validation methods specific to some field only to
> > > override the default message?  Take the following:
>
> > > jQuery.validator.addMethod("visible-required", function(value,
> > > element) {
> > >    return $(element).is(":hidden") || !this.optional(element);
> > > }, "This is required when visible");
>
> > > jQuery.validator.addMethod("visible-required-fool",
> > >    jQuery.validator.methods.visible - required,
> > >    "My specific field is required");
>
> > > I saw your talk at the conference last weekend btw.  Thanks

Reply via email to