Re: [jQuery] jQuery Projects
Jörn Zaefferer schrieb: Glen Lipka schrieb: Would this work onKeyPress? I think I get where you are going. Struggling. :( Sure, just apply the validator on keypress: $(form input).keypress(function() { $(this).validate(); }); I you have ideas to make the plugin easier to use, just tell me .-) -- Jörn Caution, keypress is fired with every blink of the cursor in IE, even if you don't really type something in... -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
Hey Klaus And the using it like this: input validate=pattern:###-###-## / And I still vote for doing in a standards compliant way... As an alternative, you can still do it standards-compliant (or write an XHTML module): input class=$v(pattern:###-###-##) / The plugin checks the class if there is no validate attribute. -- Jörn -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
Here's an idea: label for=foo class=validate 000h000h00/label input name=foo id=foo type=text / It's HTML 4.01, will probably pass for strict, and it semantically separates the validation from the field. The idea is that for every label with class validate, there's a validation mask somewhere within the classes that should be applied to the associated field. This can conceivably apply to any input, if you want to do the work. This could guarantee a set number of checkboxes are checked, one of the radio buttons has been chosen, a select is not left on its default value, etc. Some gotchas: * The only legal place to put the mask would be as a class. It would be a Bad Thing if you tried to make it the ID, since each element should have only one unique ID, and you may want to apply the same mask to a different field. The bonus here is that you can also style by validation mask. How cool would that be? (e.g.: Use a background-image of a phone icon for fields that want a phone number.) * One would need to create a language for expressing a mask using only alphanumerics and underscores, since that's what's legal in a class. This, in turn, may require enough regexp magic to make the best of us go running for the aspirin bottle. :) * One would need to support two legal HTML syntax cases - label for=foo and labelinput //label . * For broken use cases (e.g.: class=validate -- no mask is provided), one would want to bail out silently rather than throwing an error. What do you think? I'm almost feeling crazy enough to take a whack at it. It all starts with $(label), how hard could it be? :) - Brian And the using it like this: input validate=pattern:###-###-## / And I still vote for doing in a standards compliant way... -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
I don't think that, technically, things like parens and colons are permitted in a class. As an alternative, you can still do it standards-compliant (or write an XHTML module): input class=$v(pattern:###-###-##) / The plugin checks the class if there is no validate attribute. -- Jörn ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
After checking the W3C spec, it doesn't say much about what is and isn't legal in a class in HTML. It simply says that it's a CDATA. But, the examples in the spec doc do allow hyphens. I'd be cautious about what characters I use in a class, because CSS is stricter about what may be in a selector than HTML itself is, and it would be a Good Thing to be able to style by validation mask. From the CSS spec: *** In CSS 2.1, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [A-Za-z0-9] and ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, or a hyphen followed by a digit. Only properties, values, units, pseudo-classes, pseudo-elements, and at-rules may start with a hyphen (-); other identifiers (e.g. element names, classes, or IDs) may not. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier BW? may be written as B\W\? or B\26 W\3F. *** On 28/09/06, Brian [EMAIL PROTECTED] wrote: I don't think that, technically, things like parens and colons are permitted in a class. I've never had problems with parenthesis and colons in the classname. They are just ignore by the css parser. Quick test: style type=text/css .bold { font-weight: bold; } .underline { text-decoration: underline; } /style span class=bold $(something:12) underlineSome text/span Not sure how this will impact on the use of addClass and removeClass using jQuery though. As an alternative, you can still do it standards-compliant (or write an XHTML module): input class=$v(pattern:###-###-##) / The plugin checks the class if there is no validate attribute. -- Jörn ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
Brian schrieb: After checking the W3C spec, it doesn't say much about what is and isn't legal in a class in HTML. It simply says that it's a CDATA. But, the examples in the spec doc do allow hyphens. I'd be cautious about what characters I use in a class, because CSS is stricter about what may be in a selector than HTML itself is, and it would be a Good Thing to be able to style by validation mask. The validation plugin uses $v(...) as a default to hide validation rules from stylesheets. But as you can override that via an option, that would be no problem either. Just setup the validation options like this: var options = { rulesClassStart: , rulesClassEnd: , rulesDelimiter: , // other options }; That would allow you to define your validation like this: input class=required pattern:###-###-## / Obviously, it wouldn't allow you to use 'pattern' as a style class. In that case, you should just seperate styles and validations. -- Jörn ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
Brian schrieb: Here's an idea: label for=foo class=validate 000h000h00/label input name=foo id=foo type=text / *snip* What do you think? I'm almost feeling crazy enough to take a whack at it. It all starts with $(label), how hard could it be? :) That is an interesting approach. It wouldn't take much effort to build that into the existing plugin. If you want to try: Start with modifying findRules. If you want to start selecting the labels instead of the inputs, you need to modify more then that: At least validateForm and validateElement would need to be modified. -- Jörn ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
Brian schrieb: After checking the W3C spec, it doesn't say much about what is and isn't legal in a class in HTML. It simply says that it's a CDATA. But, the examples in the spec doc do allow hyphens. I'd be cautious about what characters I use in a class, because CSS is stricter about what may be in a selector than HTML itself is, and it would be a Good Thing to be able to style by validation mask. The validation plugin uses $v(...) as a default to hide validation rules from stylesheets. But as you can override that via an option, that would be no problem either. Just setup the validation options like this: var options = { rulesClassStart: , rulesClassEnd: , rulesDelimiter: , // other options }; That would allow you to define your validation like this: input class=required pattern:###-###-## / Obviously, it wouldn't allow you to use 'pattern' as a style class. In that case, you should just seperate styles and validations. Well, it looks like Joern more or less has it covered. I'd simply use something like { rulesClassStart: val-, rulesClassEnd: ; rulesDelimiter: }. He also mentions (in another email) that using label to semantically separate the validations from the inputs can be done with relatively small modifications to his existing plugin. Worth looking into. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
On 9/28/06, Brian [EMAIL PROTECTED] wrote: Here's an idea: label for=foo class=validate 000h000h00/label input name=foo id=foo type=text / What about when you want to change some aspect of the mask? Say, the phone number mask now needs to handle international numbers as well. Why not separate the mask from the class name like this: label for=foo class=validate phoneNum/label input name=foo id=foo type=text / And put the mask in the jQuery code? -- Tim ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
Having used the: input class=required us-phone-number ... method several times,,, It is definitely the way to slip the new feature by the standards! We can all see the simple jq code for implementing this. And keypress always scares me (as a user not a programmer) I hate to be told about my mistakes too early onchange is plenty time for a warning. On 9/28/06, Tim Gossett [EMAIL PROTECTED] wrote: On 9/28/06, Brian [EMAIL PROTECTED] wrote: Here's an idea: label for=foo class=validate 000h000h00/label input name=foo id=foo type=text / What about when you want to change some aspect of the mask? Say, the phone number mask now needs to handle international numbers as well. Why not separate the mask from the class name like this: label for=foo class=validate phoneNum/label input name=foo id=foo type=text / And put the mask in the jQuery code? -- Tim ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒ ░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░ ▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒ ░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░ ▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
I think that people are going to want more flexibility in terms of what they want to validate. It would be great to include very common shortcuts, like us-phone-number, credit-card-number, or email-address. But, we can't predict what everyone's data will look like. There must be a way to provide custom formats. - Brian What about when you want to change some aspect of the mask? Say, the phone number mask now needs to handle international numbers as well. Why not separate the mask from the class name like this: label for=foo class=validate phoneNum/label input name=foo id=foo type=text / And put the mask in the jQuery code? -- Tim ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
for the jQ soultuon : 1 class to mention which plugin will handle the validations 1 or more other classes as defined in that plugin we bind early on all fields that have the 'plugin' class, then we can easily handle flipping from US-phone-number to UK-phone-number.. etc! how the formats are defined is.. pure jQ magic! functions, regexps, whatever!!! This is sorely needed I am tired of doing it 'my way', I look forward to doing it the jQ way. Jake On 9/28/06, Brian [EMAIL PROTECTED] wrote: I think that people are going to want more flexibility in terms of what they want to validate. It would be great to include very common shortcuts, like us-phone-number, credit-card-number, or email-address. But, we can't predict what everyone's data will look like. There must be a way to provide custom formats. - Brian What about when you want to change some aspect of the mask? Say, the phone number mask now needs to handle international numbers as well. Why not separate the mask from the class name like this: label for=foo class=validate phoneNum/label input name=foo id=foo type=text / And put the mask in the jQuery code? -- Tim ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒ ░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░ ▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒ ░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░ ▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒░▒ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
Ⓙⓐⓚⓔ schrieb: for the jQ soultuon : 1 class to mention which plugin will handle the validations 1 or more other classes as defined in that plugin we bind early on all fields that have the 'plugin' class, then we can easily handle flipping from US-phone-number to UK-phone-number.. etc! how the formats are defined is.. pure jQ magic! functions, regexps, whatever!!! This is sorely needed I am tired of doing it 'my way', I look forward to doing it the jQ way. Well, I think I covered that, too. You need a special number format? Define it as a new validation rule and apply it to your form, that's it. // returns true, if the value does not match the pattern jQuery.validator.rules.myNumberFormat = function(value) { return !value.match(/\d\d\d-\d\d/); // change regex to whatever you need }; Is this what you had in mind? -- Jörn ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
As John pointed out, implementing some of the new W3C forms API might do the trick. Anyone have any particular parts of that API that might be a good place to start (validation comes to mind).-- Yehuda On 9/27/06, Glen Lipka [EMAIL PROTECTED] wrote: For Intuit (QuickBooks, Quicken, TurboTax). We did an ad hoc evaluation of the different frameworks and jQuery rocked.A few of us here are passing around the jQuery kool-aid. Take a sip!Here is a question: On the form validation example, take a look at the phone number mask. I think this would make a great jQuery plugin. It has the right pieces of the puzzle. Example:input type=text jMask=###-###-Works as a great constraint to keep data in the correct format. I have no idea how to port this into a plugin. I am really not that good of a programmer. I am an interaction designer.Any suggestions?Thanks for the encouragement!Glen On 9/26/06, John Resig [EMAIL PROTECTED] wrote: Woah - do you design for Quickbooks? That'd be hot :-)I really like the slidey menu - hidden, but useful, navigation.--JohnOn 9/26/06, Glen Lipka [EMAIL PROTECTED] wrote: If I am working on a jQuery project, should I post url's here for people to see? Is it inappropriate to ask for suggestions to make it tighter and better? Like this link !;) Glen ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/--John Resighttp://ejohn.org/ [EMAIL PROTECTED]___ jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/ ___jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/-- Yehuda KatzWeb Developer | Wycats Designs(ph)718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
I saw that one one. The mask I am describing is on the phone number field. It fixes formatting on the fly using keypress. (rather than Blur)So it never shows an error, it just fixes the formatting automagically. Try typing in (510) 555-12dog12. It ends up 510-555-1212. We are going to use something similar for creditcard fields, zip codes, year, or any field like that.The code for it is in the example inlineError.js file at the bottom, but it can be so much shorter using jQuery, I think. GlenOn 9/27/06, John Resig [EMAIL PROTECTED] wrote: For Intuit (QuickBooks, Quicken, TurboTax).We did an ad hoc evaluation of the different frameworks and jQuery rocked. A few of us here are passing around the jQuery kool-aid.Take a sip!That's great to hear :-) Here is a question:On the form validation example, take a look at the phone number mask. I think this would make a great jQuery plugin.It has the right pieces of the puzzle.Example: input type=text jMask=###-###- Works as a great constraint to keep data in the correct format. I have no idea how to port this into a plugin.I am really not that good of a programmer. I am an interaction designer. Any suggestions?You should check out this form validation plugin:http://fuzz.bassistance.de/jQueryFormValidation/validateTest.html I think it'll handle what you're looking for (this was fromhttp://jquery.com/plugins/).Hope this helps.--John___ jQuery mailing listdiscuss@jquery.comhttp://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
John Resig schrieb: phone number mask. I think this would make a great jQuery plugin. It has the right pieces of the puzzle. Example: input type=text jMask=###-###- Works as a great constraint to keep data in the correct format. I have no idea how to port this into a plugin. I am really not that good of a programmer. I am an interaction designer. Any suggestions? Here is a question: On the form validation example, take a look at the You should check out this form validation plugin: http://fuzz.bassistance.de/jQueryFormValidation/validateTest.html I think it'll handle what you're looking for You could add a validation rule that takes the pattern as a parameter, something like this: (function() { var match = function(value, pattern) { // matching code here }; jQuery.validator.rules.pattern = function(value, element, params) { return match(value, pattern); }; })(); And the using it like this: input validate=pattern:###-###-## / -- Jörn ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
Glen Lipka schrieb: Would this work onKeyPress? I think I get where you are going. Struggling. :( Sure, just apply the validator on keypress: $(form input).keypress(function() { $(this).validate(); }); I you have ideas to make the plugin easier to use, just tell me .-) -- Jörn ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
You can post links to whatever projects you like here, but you dont have to. Really the main reason for the mailing list is to ask for suggestions to make code better ;)On 9/26/06, Glen Lipka [EMAIL PROTECTED] wrote:If I am working on a jQuery project, should I post url's here for people to see? Is it inappropriate to ask for suggestions to make it tighter and better?Like this link ! ;)Glen ___jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
Woah - do you design for Quickbooks? That'd be hot :-) I really like the slidey menu - hidden, but useful, navigation. --John On 9/26/06, Glen Lipka [EMAIL PROTECTED] wrote: If I am working on a jQuery project, should I post url's here for people to see? Is it inappropriate to ask for suggestions to make it tighter and better? Like this link ! ;) Glen ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- John Resig http://ejohn.org/ [EMAIL PROTECTED] ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
John! Where the heck you been man? We've missed your input here. :o) Rey,,, John Resig wrote: Woah - do you design for Quickbooks? That'd be hot :-) I really like the slidey menu - hidden, but useful, navigation. --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] jQuery Projects
He's been sick man. From: Rey Bango John! Where the heck you been man? We've missed your input here. :o) Rey,,, John Resig wrote: Woah - do you design for Quickbooks? That'd be hot :-) I really like the slidey menu - hidden, but useful, navigation. --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/