Re: [jQuery] Fast form serializer function for review
I don't think that's proper behavior, though. *Both* values of foo should be posted if both are present. So, you'd either get foo=offValue, or foo=offValue,onValue. Either way, your backend code shouldn't break if the submitted fields are in the wrong order. - Brian On 10/3/06, Mike Alsup [EMAIL PROTECTED] wrote: So I think this new serialize method is pretty damn good! Is there *anyone* out there that cares about the semantic ordering of the posted values? Personally, I do not, and I definitely would like to have only a single serialize method. Maybe the semantic version could be left as a separate plugin for anyone that needs that capability. I vote for updating the form plugin with this new version. Yes, I care. Case: An unchecked checkbox doesn't post. However, you usually want to work with an on/off value. I use this construct (stolen from Rails I think): input type=hidden name=foo value=offValue input type=checkbox name=foo value=onValue This way, when the checkbox is not checked, offValue is posted for foo. When checked, onValue is posted. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Evaluating script elements
Looks good, but please don't use eval as the function name. It's a Bad Idea to overload reserved/predefined words, even if namespaced. - Brian $.fn.eval = function(callback) { ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Full featured form validation library in jQuery?
That's a lot of stuff! Seriously, I think that what is being requested here, more than anything else, is organization. Can we start grouping our code into plugin packs, or something? One for forms and friends, one for all kinds of visual effects (perhaps a package that groups the best of the best visual plugins with Interface?), one for language extensions, and so on. It might even be a Good Thing to version them, and pack them to save space. There are a lot of really great plugins here, but they're not as easily accessible as they can be. For everyone else: All these plugins are done on a largely volunteer basis. This is an unfunded, we-do-this-because-we-love-it open source project. Generally, our response to I need ___ is Great! I can't wait to see how it looks after you've written it! So, don't expect anything huge to be done upon request. But, a lot of useful plugins are already rolling around here. So, don't despair. :) - Brian One thing I'd also like to request is a complete form widgets plugin. At the moment there are a plethora of form widgets, each of them single plugins. That's not very useful for someone that wants something that gets included once and called multiple times. Ideally, someone would come out with a forms plugin that includes basic validation and error display along with form widgets. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] mouse gestures?
I don't know many people who would be able to write anything much with the mouse, but it'd be a proof of concept all the same. That's what Wacom tablets are for ;) -- View this message in context: http://www.nabble.com/mouse-gestures--tf2359444.html#a6601083 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Chainable if/else - hot or not?
I'm not crazy about the .filter()/.$else() as presented for one reason: It calls .end() as part of its implementation. Most programmers will expect to have to call .end() themselves, and it will be a bit confusing if it doesn't have to be explicitly called in this case. In fact, I don't think that people will expect the object returned by .$else(), which is the result of the .not() in the implementation (that they didn't call explicitly). The object that .$else() returns should be the original object returned by .filter() . That ends up being the making the most sense, I think. Agree? - Brian Brandon Aaron schrieb: ** Going to re-read to make sure I'm not complete off-base ** Okay ... so after re-reading I think that Jörn's first idea is the better one than the other suggestions. My only concern is that it changes the behavior of the is method. I still think making this its own method is the best option. With that said I think either modifying the is method, not method or *preferably* adding a new method with this simple syntax will be very useful! The modification to is() won't break any existing code that uses is() as documented (with only one paramter). But before closing this topic: Could you please have a look at the other solution to this: http://jquery.com/discuss/2006-October/012969/ This avoids the anonymous functions, but it's use is limited to jQuery methods. -- Jörn ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Chainable if/else - hot or not?
I'm not sure I like that. If .filter() is destructive, it should be destructive all the time. It's less confusing that way. Just my opinion. :) that is cool, but destructive... is there a non-destructive if alternative available? Or do they just remove the filtered items from the chain, and let the rest of the chain calls deal with else cases? It's completely non-destructive - that's what makes it great. .filter( string ) // destructive .fitler( string, function ) // non-destructive --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Single Value Attributes
What happens if you call .checked() with no args? Wouldn't that automatically read as false, leading to $( '#foo' ).checked() unchecking the checkbox? If called without any arguments, it should behave as if called with true as an argument. - Brian Hey everyone - I stumbled across a point of optimization today, all of the following attributes (and probably more - let me know) can only have a single value. checked=checked multiple=multiple disabled=disabled readonly=readonly disabled=disabled selected=selected I'd like to add in methods like: .checked( true | false ) Which does this in the background (but for each attribute): $.fn.checked = function(b) { if ( b ) this.attr( checked, checked ); else this.removeAttr( checked ); }; What do you think? --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] mouse gestures?
This is really good, and written better than what I could have done. In my case I'm needing it to affect numerous elements on the page such as li.sortableitem's. It doesn't seem to be allowing me to get the id of which element is clicked on. -- View this message in context: http://www.nabble.com/mouse-gestures--tf2359444.html#a6584504 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] unchange() - how does it work?
The event code only deals with unobtrusive events. If you have an inline event in the tag, you need to use the attr() method to overwrite the onchange attribute with a blank string. It sounds dumb, and... it is. But, it works. $( #myradiobutton ).attr( onchange, ).change( function() { ... } ); You can throw in unchange() anyway, for good measure, in case there may be events registered the not-inline way as well. This brings up an interesting question. Should unevent simply deal with this case? I think that adding .attr( onevent, ) to each unevent would help enforce the Principle of Least Surprise. - Brian I have a number of controls on a form that have a default onchange() function. In some places I would like to change the onchange function to something else, but I find that I have been unsuccessful in removing the default function. I have tried several different types of commands but nothing seems to work. Here is what I have so far: $(#myform).find(.inputbox).unchange().change(function() { anotherfunction(); }); input type=text name=filter id=filter value= class=inputbox onchange=document.myform.submit(); / -- View this message in context: http://www.nabble.com/unchange%28%29---how-does-it-work--tf2356323.html#a6563193 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] mouse gestures?
Has anyone done any work with mouse gestures? For example detecting if the user drug the mouse on a specific element at least 50 pixels left/right, right/left, up/down, down/up? -- View this message in context: http://www.nabble.com/mouse-gestures--tf2359444.html#a6573213 Sent from the JQuery mailing list archive at Nabble.com. ___ 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. 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
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] Form plugin's serialize(): performance issues
Perhaps there should be a FastSerialize method, that doesn't guarantee semantic order, and uses every shortcut to cut down on dom-walking time? This way, the developer can choose whether to use the faster method, or the slower-but-correctly-ordered method. - Brian Can you explain why processing elements in semantic order is important? Two reasons: $(input | select).eq(0) This should access the first matched element of input or select - when the order isn't important, you'll never know which element will actually be first. It's important that the element is actually the first element in the document. Secondly, when serializing forms, the order of the elements that comes back is frequently important - having a different order can cause problems for certain applications. --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Hiding multiple elements, then showing one
I have a little bit of code that I want to hide x amount of divs, then when they're all hidden to show a specific one. Right now I have this... // hide all found divs $(settings.slide).hide(); // get the slide that i want shown div = $(settings.slide).get(i); // show the slide when everything is hidden $(div).fadeIn(); How do I chain a hide all, then show one function? -- View this message in context: http://www.nabble.com/Hiding-multiple-elements%2C-then-showing-one-tf2318376.html#a6449115 Sent from the JQuery mailing list archive at Nabble.com. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] $([EMAIL PROTECTED]'FieldName']) does not work in Firefox
Might be related to bug #194, which Joern squished last week. Try the latest build? - Brian When attempting to get an element with the name (the same happens when I use 'id') ends with 'FieldName' I get an error 'z has no properties'. I am doing this as the page is an ASP.NET one (so the name is generated server side, but always contains 'FieldName'). Seems to work fine in IE though. I am doing this to give 'FieldName' focus when the page loads. $([EMAIL PROTECTED]'FieldName'])[0].focus(); Using * (contains) instead of $ causes the same error. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Bug in .color() / Firefox
I vote for color() always returning the same value. The problem is that the code to clear that up is pretty bulky, by jQuery standards. If we re-wrote it to be smaller overall, it might be a candidate for inclusion. Otherwise, John might ask that we make it a plugin. - Brian On 9/18/06, Klaus Hartl [EMAIL PROTECTED] wrote: color() returns the computed style and in Firefox this is the RGB notation, no matter how you specified the color in the style sheet (name, hex, rgb). So this is not a bug. I'd write a RgbToHex function that transforms the Rgb value into Hex again or simply passes back the value if it is already hex... Thanks for clearing that up. I was hoping I could just use jQuery to get a predictable value back from all browsers rather than resorting to a custom function just to satisfy the Firefox edge case :) On 9/18/06, Stamen Georgiev [EMAIL PROTECTED] wrote: I'm using this function (getCV) to do the trick: Hope it helps Thanks for sharing your code! Does anyone else think this is something that jQuery should standardize, or is it just not worth it? Or should it be a new function .colorHex()? thanks, Justin. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] remove [EMAIL PROTECTED] frome the mailing list
The URL of the mailman manager page is actually in the headers of the email, but a lot of mail readers aren't going to do anything special with it. Here it is, for those who need it: http://jquery.com/mailman/listinfo/discuss_jquery.com Perhaps unsubscribe instructions should be included in the jQuery footer? Best wishes, Dave Cardwell ~ http://davecardwell.co.uk/ Charles Crépeau wrote: can you please remove this email from your mailing list , thanks -- Charles Crépeau ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Anyone explain why this won't work in Safari
It would help if I typed in the correct address! Sorry about that... http://www.aliasenterprises.com Try this one. Thanks, Brian John Resig wrote: Is there a problem with .ready? Short answer: most likely not. However, your server seems to be down so I can't check it right away to make sure. --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/