Ah, agreed. I'll make these changes and send in a ticket.
On May 15, 4:20 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]> wrote: > How about this? > > meta: default > class="{required:true,minlength:2,messages:{required:'Enter > this!',minlength:'Way to short'}}" > > meta: "validation" > class="{validation:{required:true,minlength:2,messages:{required:'Enter > this!',minlength:'Way to short'}}}" > > No need to change the meta-option that way. The code reading the > messages just checks for a messages-property within the metadata. > Avoiding the conflict between a method "messages" and those actual > messages should be easy enough. > > Contributions are welcome in any format, a ticket on dev.jquery.com > with a diff attached is the preferred way. > > Jörn > > On Thu, May 15, 2008 at 5:23 PM, Dane <[EMAIL PROTECTED]> wrote: > > > Ok I have a first cut done. elements can now have metadata like: > > <input id="cname" name="name" class="{rules:{required:true,minlength: > > 2}, messages:{required:'Enter this!', minlength:'Way to short!'}}" /> > > > Quick question though. Which do you prefer? > > > 1)$("#Form").validate({meta:"rules", metaMessages:"messages"}); > > 2)$("#Form").validate({meta:{rules:"rules", messages:"messages"}}); > > > I like 2, but it changes the existing API. > > > How do you want the changes? > > > On May 14, 1:04 pm, Dane <[EMAIL PROTECTED]> wrote: > >> Thanks for the help on getting started. I'd already started wading > >> through the source so you definitely saved me some time. I'm not > >> totally comfortable with Jquery yet but I'm getting there :). I'll > >> give this a go and see what happens. Should I just reply to this > >> thread to contribute/ask questions? or is there a better way? > > >> On May 14, 12:07 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]> > >> wrote: > > >> > It isn'T supported, yet. You could help getting it into the plugin by > >> > trying to implement it yourself, and contributing it back. > > >> > To get started, take a look at the defaultMessage-method. Currently it > >> > looks for custom messages specified via options, then for the title > >> > attribute, then for default messages. You can access metadata via > >> > $(element).metadata(). > >> > To be able to throw rules and messages together, you'd use the > >> > meta-option to "namespace" rules, eg. > >> > class="{rules:{required:true,email:true}, messages: {required:"yo", > >> > email:"no"}", then $(...).validate({ meta: "rules" }) > > >> > Hope this helps to get started. > > >> > Jörn > > >> > On Wed, May 14, 2008 at 5:11 PM, Dane <[EMAIL PROTECTED]> wrote: > > >> > > Hi, > > >> > > I'm trying to build a web framework utilizing the great work thats > >> > > already been done on the validation plugin. I'm trying to use metadata > >> > > to specify my rules. I'm having a problem overriding the default > >> > > messages for multiple rules via metadata. It appears as though I can > >> > > only specify one generic message for all my rules on a given element > >> > > using the title attribute. > > >> > > Is there a way use metadata to override error messages that I'm > >> > > overlooking? If not can this be added? Additionally, do we have to be > >> > > restricted to using the title attribute? Could we use custom > >> > > attributes? It seems like a common scenario and is supported by the > >> > > validate(option) method. > > >> > > Thanks for any direction/feedback on this! > > >> > > Keep up the great work! > >> >> Dane