Can't apply the patch, see comment on ticket. Jörn
On Wed, May 21, 2008 at 1:09 AM, Dane <[EMAIL PROTECTED]> wrote: > > Ticket #2908 created and patch attached. Let me know if I should > change anything. > > On May 19, 1:57 pm, "Jörn Zaefferer" <[EMAIL PROTECTED]> > wrote: >> Just use "messages" for embedding messages as metadata. The odds of >> adding a method "messages" are extremely low, and once its released, >> I'll update the docs accordingly. >> >> Jörn >> >> On Fri, May 16, 2008 at 7:05 PM, Dane <[EMAIL PROTECTED]> wrote: >> >> > -> "Avoiding the conflict between a method "messages" and those actual >> > messages should be easy enough. " >> >> > Should we plan on supporting a simulatanious "message" method and >> > custom messages in metadata? >> >> > As stated, I'm still climbing the learning curve :). Before I >> > implement this I just want to make sure your not envisioning a better >> > way. The strait forward check I'm planning on is to see if validator >> > has any "message" methods defined, if it does it will treat "messages" >> > in meta as a rule method, else it will treat it as a custom message >> > object. This check, however, means a dev can't simultaneously have a >> > method named "message" and still use custom messages in metadata. A >> > minor, but strange requirement. Is this ok? >> >> > I was trying to figure out a way to compare the message object in meta >> > to the "message" rule signature. If the method sig matches it will be >> > treated as rule metadata, else custom message metadata. Don't know if >> > we can guarantee repeatable results with that since rule method sigs >> > can match the custom message object in rare cases. Leaving us with an >> > even more rare, but stranger requirement. >> >> > I'm probably missing something so i figured I'd just ask what you had >> > in mind that was "easy enough". >> >> > Thanks >> >> > On May 16, 9:33 am, Dane <[EMAIL PROTECTED]> wrote: >> >> 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 >