[Proto-Scripty] Re: Does $A('.classname').invoke('setValue',...) work on checkboxes?
joe t. wrote: i agree on that. setValue has its purpose pretty much in the name. Set the value of a control. For checkboxes, setChecked (bool) (also applying to radios?) would have made a lot more sense. Yes, it does apply to radios to. It's a shame that the docs aren't clear on this behavior. You can play a little with this test page: http://tsalarioth.art.pl/~sw/setValueTest.html I personally think it would be better if setValue on radio and checkbox either really set the value, or set the checked state base on comparison: Element.setValue = function(element, newValue) { $(element).checked = ($(element).value == newValue); } This way, you could check or uncheck the element, especially radio, based on that if value is matching. This would be useful for methods similar to Form.unserialize(); It is of course impossible to be done at this state of the library, where the code is used in (hundreds of) thousands of scripts among the web. I will probably write additional method for my needs with use of the excellent Element.extend method. Anyway, I want to thank all the prototype.js developers, doc writers and supporters for your work on the library. Great job! Best regards, SWilk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: JSON - which chars not accepted?
Hi, I there a documentation to this function? I would like to read something like this: isJSON does not accept \n chars and @ chars in a string. The docs say what it does: It checks to see if the string is in valid JSON notation. To know what valid JSON notation is, please (again) refer to the link I've given you. For example: Why does isJSON disallow newlines inside JSON strings? Because http://JSON.org tells us that a JSON string may contain ...any-Unicode-character-except--or-\-or-control-character and newline is a control character. So if you want to know what isJSON is going to consider valid, refer to the definition of JSON, which is at http://JSON.org. -- T.J. On Nov 11, 4:01 pm, Manfred Rebentisch mrebenti...@comparat.de wrote: Hi ok, please read, what I mean. My code actually runs perfectly. In the past I have had problems with the newline and found, that isJSON() checks the string coming from server. Thats fine. I only want, that I did not run into new problems later, and want to understand, what isJSON() does. So I do not understand the regular expression until now: str = this.replace(/\\./g, '@').replace(/[^\\\n\r]*/g, ''); return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); I there a documentation to this function? I would like to read something like this: isJSON does not accept \n chars and @ chars in a string. It is for security and that is fine. But it is not fine, if my customer find a problem later. Thank you in advance Manfred --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Prototype.jExtension
Hi, This has some nice ideas like Element.ajaxRequest() (which I would have called Element.ajaxUpdate() since it is what it does :o) ), but also some features I fail to see any utility to. I.E., what's the point to use 'string'.len() instead of 'string'.length? Same thing for $('someElement').getType() instead of $ ('someElement').nodeName Also, try to limit the impact on performances by avoiding tests in loops when you can do them outside of the loop. I.E, in your Array.compact version, you may replace : compact: function(strict) { return this.select(function(value) { return strict === true ? value != null value.strip() != '' : value != null; });} ...by something like: compact: function(strict) { return this.select(strict === true ? function(value) { return value != null value.strip() != '' } : Prototype.K);} The procedure to submit contributions is described here: http://www.prototypejs.org/contribute You may propose some of yours (I'd recommend proposing only the more interesting methods) once you've validated that they don't break the test cases. HTH, Eric On Nov 10, 10:07 am, Jacopo Andrea Nuzzi jacopo.nu...@gmail.com wrote: Hi Tobie, thanks for you suggest: here it is:http://tr.im/EBEP Jacopo On Mon, Nov 9, 2009 at 9:35 PM, Tobie Langel tobie.lan...@gmail.com wrote: Hi jacoz, Seems like your Array#add would benefit from using Array#splice. https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Object... Best, Tobie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Observing multipart/form-data oncomplete
I'm using document['formID'].submit() to submit a multipart/form-data form for multiple files upload. I want to observe the upload process and fire additional events once the file/files has been uploaded. I'm using a iframe for the upload form and looking for a way to observe the onComplete state of the submitted form. I'm not using the Ajax.Request since I'm uploading files through a iframe...feels like there's a simple and basic solution I've missed. Help appreciated --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: formatting list item content in Ajax.Autocompleter
Yogesh, I am stymied by one last hurdle as I get closer. I am loading text embedded inside span elements and inserting them into the li elements that comprise the drop down list items of the autocompleter. Works just as required. When the user selects one of the items in the list, I had assumed that contents of the li item will be copied over verbatim, but only the text is copied over. span and any other HTML tags are not copied over. There is no Autocompleter option to change this behavior. What are my options if I want to copy over the text from the li item into the text box, intact? Thanks. Ashwin On Nov 11, 3:48 pm, Yogesh Agashe yogesh.aga...@gmail.com wrote: Sure, glad that I was able to help you ! Yogesh Ashwin wrote:In addition to your snippet, I had to add the following CSS attributes to the LI element: position: relative; overflow: auto; and slightly increased the width of the container UL element. It is now showing up as expected. Thanks for your help! Ashwin On Nov 11, 2:15 pm, Yogesh Agasheyogesh.aga...@gmail.comwrote:I have a list with 3 columns. This is the code. You just modify it a little bit for your page. li Name span class='citystateinlist'City,State/span span class='dateinlist'Date/span /li .dateinlist{ float: right; width: 80px; } .citystateinlist{ float: right; width: 150px; } Ashwin wrote:Hi Yogesh, You gave me some food for thought! I added float:left; and width: 300px; attributes to all the span tags just to see how that turns out. When I do that, the span elements are outside the enclosing li elements, one below the other. I am no CSS expert, so I could be messing up somehow in that area. Can you send me a relevant snippet of the CSS that you employ for this effect? Thanks, Ashwin On Nov 11, 12:59 pm, Yogesh Agasheyogesh.aga...@gmail.comwrote:Hi Ashwin, How about floating the span elements? I have similar list and I use float. Add a class to your span elements. In CSS, assign a width and float them left or right as per your requirement. HTH. Yogesh Ashwin wrote:One of the reasons I like the Google Suggest powered autocomplete function at Google Finance (http://finance. google.com) is because the drop choice choices appear in a tabular format with 2 columns. The left column contains the ticker symbol and the right column contains the company name. I am trying to emulate a similar effect but with 4 columns. Without thinking about customization, my first attempt involves trying to return data that looks like this from the server sideul lispan style=width:50px;1/spanspan style=width: 150px;Jane/spanspan style=width:150px;Doe/spanspan style=width:250px;Director/span/li lispan style=width:50px;2/spanspan style=width: 150px;John/spanspan style=width:150px;Doe/spanspan style=width:250px;Manager/span/li lispan style=width:50px;3/spanspan style=width: 150px;Peter/spanspan style=width:150px;Tr ent/spanspan style=width:250px;Developer/span/li /ulIn a regular HTML page, this has a tabular look to it. But when this content gets loaded in the autocompleter's DIV element, it gets treated just like HTML whitespace.Am I missing something here, or are there better ways of doing this?Thanks!Ashwin- Hide quoted text -- Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: formatting list item content in Ajax.Autocompleter
My server-side script generates the ul.../ul structure to pass back to the update div element. The li elements contain some text embedded inside span. Here is a sample of what the server-side script passes back to the Ajax.Autocompleter instance: ul li style=overflow:auto;span style=display:none;1/spanspan style=width:150px;float:left;John/spanspan style=width: 200px;float:left;Doe/span/li li style=overflow:auto;span style=display:none;2/spanspan style=width:150px;float:left;Jane/spanspan style=width: 200px;float:left;Doe/span/li /ul (The reason I do this is because I want to see the drop down list display the list items in a tabular layout... which was the original topic of this thread) However, when I select an item from this drop down list, only the plain text gets copied into the element i.e. the input text box) linked to the Ajax.Autocompleter control. What I need is for the contents of the selected li element to be copied over, so I can work with the raw HTML as needed. When I perused the JS source, I understand that the updateElement function is responsible for the copying, and it employs Element.collectTextNodes and Element.collectTextNodesIgnoreClass methods to extract the textual content from the selected li element. I tried to hack my way around this by replacing the line: value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); with: value = selectedElement.innerHTML It seems like this works, but I am very averse to modifying well- tested code (not to mention, my JS skills are very immature) and potentially breaking another part of my application that depends on the default implemented behavior of this control. Can anyone tell me if there is some (more recommended) means of copying the contents of the selected li element into the text box without modifying controls.js? Ideally, it would be nice to have an option to use in the constructor, to toggle between copying raw content versus textual content. Thanks. Ashwin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---