[Proto-Scripty] Re: Is someone working on Scripty2?
i created a live bookmark in Firefox well over a year a half ago that was supposed to provide news updates for Scriptaculous/Scripty2 (http://feeds.feedburner.com/scriptaculous) in that time, the only news items were 1 post about a maintenance release to fix a Prototype 1.7 compatibility issue, and 3 posts about online Javascript Master Classes. Personally, i think it's time to call the patient's Time Of Death. Javascript engines have been advancing, new functionality being added to the core language, new devices platforms for JS to adapt to... Most libraries are keeping up while Proto Scripty 1 2 have barely shown signs of a heartbeat. It used to matter to me, but i haven't even used Prototype in over a year. -joe t. On Nov 30, 1:41 am, Victor vkhomyac...@gmail.com wrote: Is Scripty2 still developed? Or it is as alive (half-dead, actually) as Prototype? I've posted tickets on both projects in Lighthouseapp but no response... -- 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: Adding CSS-Rules to a styletag in Prototype
i don't think Prototype has a method for directly editing a STYLE tag (only for modifying styles on element[s]. But http://stackoverflow.com/questions/524696/how-to-create-a-style-tag-with-javascript seems to offer a couple cross-browser approaches by examining feature support to determine which way to append style rules to the interior of a STYLE tag. i haven't tested, but as they say, seems legit. -joe t. On Oct 17, 11:55 am, Luke lukas.bomb...@googlemail.com wrote: Hi there, I wanna add CSS-Definitions to a style-tag using Prototype. In all good browsers (ALL^IE) this works by simplay appending a CSS-String to the desired style-tag. IE doesn't like this though. I found [1] that in IE you can update the entire contents of the style-tag using an attribute named * cssText* but that doesn't append but replace the all definitions. So I was wondering, does Prototype JS already have a method to append style-definitions to a styletags for all browsers? Thanks, Lukas [1]http://acidmartin.wordpress.com/2009/05/06/creating-style-tag-with-ja... -- 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.
Re: [Proto-Scripty] is Ajax.Autocompleter working in prototype 1.7 and scriptaculous 1.9?
I have it working right now but there seems to be some sort of bug. I can't tell if it's prototype or scriptaculous but my autocompleter doesnt show the drop down in the right place. The drop down is covering the input field instead of being below it. It's working in my old rails2 project with prototype 1.6.0.3. I came here this morning to see if anyone knew why that was happening. On Wed, Jun 1, 2011 at 5:46 AM, macm moura.ma...@gmail.com wrote: Hi Folks Is Ajax.Autocompleter working in prototype 1.7 and scriptaculous 1.9? Reagards Mario -- 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. -- 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: future of script.aculo.us
The biggest difference between the two at their core is that Prototype directly modifies javascript's native objects (Array, Object, String, etc.) while jQuery does not. A more subtle difference is how the use of the $() function to address DOM objects. Prototype's $() receives a simple string (or list of strings) which match DOM element ID names, while jQuery's $() receives a valid CSS selector and creates a collection of matching elements (even if it's only 1 element in the case of $(#elementID) ). Prototype separates that approach into the $ $() function to create an Enumerable instance. There are plenty of other differences, in varying degrees of subtlety. But more important, i think, is what the libraries have in common: a very easy to learn way to perform several tasks on the same starting point target by chaining methods together.But since almost all libraries of this style provide that, i agree with other posts that it's probably more important to impress the fundamentals of Javascript so students know how/why the libraries work the way they do, and why these different approaches are both valid, and can, with care, co- exist. -joe t. On Mar 24, 6:09 am, Ali.MD alimihando...@gmail.com wrote: thank you very much my question about future jQuery and prototype and some other javascript library is similar to each other I can not find a significant difference between them. is that right ? a agree jquery is better to teach. and we must to teach other javascript library with jQuery I'm worried about the future What the future will be Prototype and script.aculo.us if my future developers want to choose only one library. Which should we choose for future ? and why ? i dont worry about plugins and extensions because we can use all of them together ;) -- 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: Why is there a $super-Parameter?
i'd been kicking the sand wondering if i should go ahead and ask you to re-post that link, because i'd seen it months ago and then lost it. Glad this came up again (as i'm sure it will in the future) so i could just jump at the link and say thank you. And you're exactly right about the complexity trade-off. Had your approach been implemented in Prototype to save on performance, i never would have understood it when i first started learning Prototype. Now that i know it really well, and understand the fundamentals of this much better, i'm going to adopt your method. -joe t. On Mar 18, 12:13 pm, T.J. Crowder t...@crowdersoftware.com wrote: Hi again, Sorry for the double-post, somehow I managed to forget to say: My mechanism isn't just (slightly) more long-winded, it's also more complex to understand -- it demands more of the programmer. That's its real downside, not the trivial difference in the length of method.$super.call(this, arg); vs. $super(arg); To use my mechanism, you have to understand how JavaScript functions and the `this` keyword work, and it's very easy to make mistakes like this: method.$super(arg); ...which fails when the parent class's code tries to use `this`. So it's about trade-offs. Prototype's mechanism is more newbie- friendly, and there's real strength in that. My mechanism is dramatically more efficient, and quite easy to use once you understand the language a bit better, but not for newbies. -- T.J. :-) On Mar 18, 4:01 pm, T.J. Crowder t...@crowdersoftware.com wrote: Hi Ryan, Just want to point out that the marked runtime cost is only at class definition time, not instance creation nor method call time. Actually, it's every single time anything calls a method that has the ` $super` argument (whether the `$super` argument gets used or not). Every single call, there are multiple overhead function calls and a function *creation*. Here's what happens: 1. The call to your method is actually to a Prototype wrapper for your method 2. The wrapper calls `Function#bind` (yes, every time) 3. `bind` calls `Array#slice`, because `bind` handles arguments (although it doesn't in this case) 4. `bind` creates and returns a new function 5. The wrapper calls its internal `update` function to update the arguments 6. The wrapper calls your actual method via `apply` If you actually *use* `$super`, then there are about five extra function calls involved before the parent method actually gets called (but no new functions get created). So the runtime costs are significant, not just at `Class.create` time (decompiling every public function in your class to find out whether it has a `$super` argument), but also on each and every call to a method with a `$super` argument (several additional function calls, including creating new function objects). Probably *at least* 95% of the time you *don't care*, but still, I was pretty shocked when I found out what it was doing, which is what lead me to thinking if there was a better way. My mechanism doesn't do any function decompilation, doesn't create any functions when your methods are called, and introduces *no* extra calls at all [a call to one of your methods goes straight to your method, and your call to the parent method goes straight to the parent method (unless you use an optional helper function)]. But the notation is a bit longer. ;-) How much longer? If you use proper named functions, the call can be method.$super.call(this, arg); ...compared with Prototype's: $super(arg); If you use anonymous functions (`method: function(arg) { ... }`), then it's this.method.$super.call(this, arg); I don't use anonymous functions, so I get the shorter one. -- T.J. :-) On Mar 18, 2:39 pm, Ryan Gahl ryan.g...@gmail.com wrote: On Fri, Mar 18, 2011 at 9:30 AM, T.J. Crowder t...@crowdersoftware.comwrote: Prototype's magical `$super` comes at a marked runtime cost Just want to point out that the marked runtime cost is only at class definition time, not instance creation nor method call time. So yeah, the performance thing is a non issue. -- 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: What do you think of this software-architecture?
It's a pretty broad question to cover in a simple answer, and while you reference Prototype, you don't seem to need direct help with the library itself, but are looking for guidance to your usage in a large- scale application. The first potential down side i see is, what happens once the user gets 10 sections loaded up in edit mode, and the browser crashes? i mean, such things have been rumored to happen, so do you have a caching/recovery system? Are you allowing all sections to be edited simultaneously? Because that seems like a lot of memory consumption to provide a multi-tasking feature that i think few people could use effectively. One section edited at a time would suit most people (especially if it's a static content page the user is building), which would then mean you only need one instance of the editing methods to pass around to whichever section is currently in edit mode (and potentially eliminate the ugly numeric method naming). Just a couple thoughts. Take from them what you will. -joe t. On Mar 21, 4:20 am, Luke kickingje...@gmail.com wrote: Do you see any downsides to this? -- 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.
Re: [Proto-Scripty] Re: Redrawing Autocomplete Field
I finally figured out my issue. I was being bitten by the fact that evalScripts evals scripts in the local scope to the prototype object. This was fine when my script was loaded from the start, but if that script was drawn to the page via an AJAX call it would get executed in the wrong scope and all weird things would start happening. On Tue, Mar 15, 2011 at 5:59 PM, joe t. thooke...@gmail.com wrote: When the Autocompleter is initialized, the options are set as such: ... this.options.minChars = this.options.minChars || 1; ... Your 0 evaluates as false-ish, so trips over to 1. i'm pretty sure the reason for requiring at least 1 character in the lookup string is that the result list attempts to highlight the matching string pattern in bold, so when that string is empty, it could cause problems. Mostly that's a guess, but that line in the Autocompleter.baseInitialize is why you can't get a list on empty - it's not actually using your 0. As for why it generates a request on the empty string...i believe that's being triggered by the onKeyPress handler. It's intended to handle key navigation for the INPUT vs. the results list. Since it doesn't trap DELETE or BACKSPACE, it simply less their events pass through the handling down to this section: this.changed = true; this.hasFocus = true; if(this.observer) clearTimeout(this.observer); this.observer = setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); It tells other methods that the value has changed, has focus, and resets a timer to call the next Ajax request. Since you're handling empty strings on your server side, you see a successful round-trip AJAX request. But Autocompleter doesn't do anything with the result per the reason above. You'd have to write an override function of some sort, and make sure that the empty string doesn't harm other areas of the Autocompleter class. However, i recommend that you note to your user they can use some special character (usually *) to search all, then handle the * on the server side. -joe t. On Mar 15, 12:58 pm, pipplo joe.kos...@gmail.com wrote: Ok, I've done some more debug. The autocomplete text box works still. But it doesn't seem to work with 0 chars. I can see when the user clicks in the text box a request is generated, and a response is generated. I can use the chrome debugger to see that the response is as expected. The AJAX request seems to just not render the HTML when the number of chars is 0, even though it does all the work to generate a request and parse the response. As soon as I type a character I get the expected auto-complete results displayed. When I backspace back to 0 chars it doesn't display anything, but it still does the AJAX request. There must be a place in prototype.js where there is a decision to render the html or not? I can't seem to find it. So I'm just looking for some hints on why that wouldn't happen sometimes.. On Mar 14, 11:27 am, pipplo joe.kos...@gmail.com wrote: I have a weird bug that I'm having trouble debugging. I am using Rails but I think the issue is in the javascript handling somewhere. I have a div with a form and autocomplete div id=form form info autocomplete box /form /div I have the options set so that when the user clicks in the auto- complete they get an initial list (minChars = 0) When the user types a user name in the autocomplete and selects one of the drop down options I generate a request via Ajax and render the form again without the autocomplete. The user can then click 'remove' to remove the user info and re-draw the autocomplete box. After the re-draw the minChars = 0 doesn't work. Whenever I click in the box I see a request generated to my controller, and I return the correct information but it doesn't get rendered into HTML and I dont see a drop down. If the user types a letter or name then the dropdown lits does show up, but the initial ajax request never gets reflected. I assume there is some state variable that thinks the text box hasn't changed value or something which is preventing actually rendering the HTML returned by Rails. I hope that makes sense. Any ideas? P.S. My current workaround is to just hide the autocomplete field and not render it empty. This works but won't be usable in other parts of my site. -- 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. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us
[Proto-Scripty] Re: Rails 3.1 - Prototype = WTF?
Excellent. Thanks for providing that quote. j On Mar 15, 2:49 pm, Felix felix1...@gmail.com wrote: Hi, I found this answer(by andrew dupont) in quora to a question about the prototype library. Question was What must Prototype JS do to become the library of choice?Edit Once Prototype JS was very popular until jQuery was released and became very popular. What are the things you feel Prototype JS must do in order to become the library of choice?. Answer by Andrew Dupont. I'm the co-maintainer of Prototype. I don't speak for Tobie (my fellow co-maintainer) or Sam (who created Prototype), but here's what I feel: In recent years, Prototype has been starved for development resources. Unlike jQuery, nobody's working on it full-time; I work on it more than anyone else, but I've got a full-time job as well. On one hand, we're genuinely out of new areas to tackle and are looking more toward a reimagining of the existing API than toward adding large new features; on the other hand, there's a definite lack of polish, and I hope to address that in subsequent releases. Where would I improve Prototype? Well, let's start with Keith's list. About half of it is stuff that we've got planned, whether for a 1.X version or for 2.0 (anything that affects backward-compatibilty must wait for 2.0). Some of it is being worked on (like the UI library — I'm building one for script.aculo.us 2.0). Some of it is a matter of opinion. Keith and I will have to disagree on the trying to make JavaScript feel like Ruby thing; the entire point of Prototype is that JavaScript and Ruby are so close in philosophy that we can borrow concepts from Ruby without having them feel tacked-on. And some of it, like the plugin ecosystem, is something we'd love to fix if we had the resources. Too often, open-source libraries are pitted against one another as though they were competitors in a marketplace. I honestly don't care who has the greatest market share — I care only that Prototype has enough mindshare to keep it viable (so that it can keep improving through patches, bug reports, and so on). So here's my answer: to become the library of choice, we'd probably have to change so much about ourselves that we'd be unrecognizable. I'm not interested in doing that. If that means we're a niche library, so be it — we'll be a niche library with purpose. But do remember that the niches themselves are quite large. In terms of market share, jQuery won because it is genuinely good, easy to learn, and easy to drop into any environment. But market share is just one way of measuring impact. The Dojo guys are the revered badasses of the JavaScript community even though Dojo has never been a dominant toolkit. Dean Edwards has a statue in the JavaScript pantheon even though none of his toolkits have seen widespread adoption. It's a big world and there's room for all of us. You can read more about this question athttp://www.quora.com/What-must-Prototype-JS-do-to-become-the-library-... Felix On Mar 15, 9:58 pm, greg g...@reservation-net.com wrote: I don't often post here, but I've been using Prototype extensively for the last 6 months. Not a day goes by when I don't say something to myself along the lines of Thank God for Prototype. Perhaps, had I started with J-Query, I'd have said the same thing about it - but I didn't, and I'd like to continue with Prototype. It could very well be the Prototype developers are: bored, busy, broke, out of ideas, or any combination. Maybe instead of just saying things like we'd like Prototype to be more popular and do more things in less space, and be more relevant, etc, someone should create a wish- list page, with a prominent 'Donate Here' button. I don't work for free and don't expect others to either. (I just checked and Prototype's web page does not have a donate button). Programmers all like a challenge, so if we as users can come up with concrete wishes for Prototype then perhaps the developers will take up the challenge. And, Thank God for Prototype! On Mar 14, 10:34 pm, Jason jwestbr...@gmail.com wrote: I agree and would like to see Prototype start returning to the forefront as the powerful JS library it is -- 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: Rails 3.1 - Prototype = WTF?
How did i manage to edit the topic subject? Wasn't intentional, since this is OT from the user assistance intent... Odd. -jt On Mar 14, 9:46 pm, joe t. thooke...@gmail.com wrote: Another anecdote along with Jane's... i make a lot of comparisons to jQuery as well because it's the only other library i've gotten familiar with. i still really like Prototype's robust set of utility data storage functions. i get wary of storing data directly on elements [jQuery.data()] and sometimes it's simply not appropriate to do so, so having Prototype's pseudo-class structure to drive the overall functionality of a page is very helpful, because i can create class members and manage data there, rather than in the HTML area of the DOM. Classes really helped me build complex JS applications when i was still brand new to application-style Javascript AJAX. That said, Prototype is bloated, and doesn't play nice with others. Scriptaculous is old, just as bloated, and i think 1 or 2 lines of code have been updated in the last year, to provide Pt 1.7 compatibility. Plus Scriptaculous doesn't provide an actual UI, just some enhanced visual effects other tools. And you have to be careful of a lot of gotchas in those effects because Scriptaculous doesn't wrap your code into HTML object references that it will need to make those effects work. jQuery's UI does that. One of the bigger advantages of Scriptaculous is Builder. i much prefer creating HTML through a node/tree structure than slapping an HTML string into an element. However, someone went and built a jQuery plugin to do what Builder does. /shrug i've noted elsewhere in this group that i don't like that there are several aliases for many of Prototype's functions, most of which are unnecessary Rails translations for otherwise sensible names. i get that it's supposed to help Rails devs use Prototype efficiently, so why not just keep only the Rails versions of functions and drop the aliases? jQuery tends to provide one way to do a lot of things. Prototype tends to provide a lot of ways to do one thing. i didn't like jQuery at first for all the reasons i stated above for liking Prototype. Once i got the hang of the major differences slight syntax variations, i've found it to really save time in a lot of ways. Granted, i also haven't built any huge application-level code using jQuery yet, but i feel like i could now that i understand the inner workings better. Jane mentioned event handling. i can go either way with that. Prototype's Function#bind makes it easy to incorporate the Class object into an event handler, but you lose context of the element unless you use Event#findElement. And i really like Event#on, but haven't done any heavy lifting with Prototype since 1.7 was released. So jQuery's handlers work fine for me. i've also never developed with Rails, and maybe because of that i don't feel a particular loyalty. i want the right tool for the job at hand, and lately that has been jQuery. Especially the ease of using plugins for missing functionality, and the UI library which amazes me. But to address your actual question: Why has traffic died down in this group? My personal observation would be that jQuery has simply gained traction over the last couple years. Prototype... i don't know. Kinda feels stale, neglected, and maybe a bit stuck in its ways? It seems like there's a lot of push to make JS libraries cooperate with each other so you can get the best each has to offer, yet Prototype can't get itself away from modifying native objects, which forces everyone else to provide safety schemes to accommodate. Also, where most libraries provide compression-safe code, Prototype stays pretty rotund at ~160K. Add Scriptaculous and you can hit 1MB of library before you get to any of your own code. In spite of criticisms, i don't want this to feel like a slam against Prototype. Obviously i still get something out of it or i'd drop my subscription to the groups. But you ask why the traffic has slowed to a crawl, and that's my opinion: Prototype itself has also slowed down. Check the dev group if you don't believe me (http://groups.google.com/ group/prototype-core/topics?hl=engvc=2). Two legitimate threads with posts in 2011, and those being about bugs, not additional development. So there's my $0.02+... i feel your frustration, though. -joe t. On Mar 14, 1:53 pm, Walter Lee Davis wa...@wdstudio.com wrote: Sorry for the rant, but I came to Prototype by way of early exploration with Rails. I found Prototype approachable and learn-able in a way that I didn't (and don't) find jQuery to be. I've invested years in learning Prototype and it has trained and patterned my JavaScript brain. I'm quite cheesed about the notion of having to learn another way to look at JavaScript. At the same time, I can't help but notice the crickets around here lately. When I joined this list (back
[Proto-Scripty] Re: Redrawing Autocomplete Field
When the Autocompleter is initialized, the options are set as such: ... this.options.minChars = this.options.minChars || 1; ... Your 0 evaluates as false-ish, so trips over to 1. i'm pretty sure the reason for requiring at least 1 character in the lookup string is that the result list attempts to highlight the matching string pattern in bold, so when that string is empty, it could cause problems. Mostly that's a guess, but that line in the Autocompleter.baseInitialize is why you can't get a list on empty - it's not actually using your 0. As for why it generates a request on the empty string...i believe that's being triggered by the onKeyPress handler. It's intended to handle key navigation for the INPUT vs. the results list. Since it doesn't trap DELETE or BACKSPACE, it simply less their events pass through the handling down to this section: this.changed = true; this.hasFocus = true; if(this.observer) clearTimeout(this.observer); this.observer = setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); It tells other methods that the value has changed, has focus, and resets a timer to call the next Ajax request. Since you're handling empty strings on your server side, you see a successful round-trip AJAX request. But Autocompleter doesn't do anything with the result per the reason above. You'd have to write an override function of some sort, and make sure that the empty string doesn't harm other areas of the Autocompleter class. However, i recommend that you note to your user they can use some special character (usually *) to search all, then handle the * on the server side. -joe t. On Mar 15, 12:58 pm, pipplo joe.kos...@gmail.com wrote: Ok, I've done some more debug. The autocomplete text box works still. But it doesn't seem to work with 0 chars. I can see when the user clicks in the text box a request is generated, and a response is generated. I can use the chrome debugger to see that the response is as expected. The AJAX request seems to just not render the HTML when the number of chars is 0, even though it does all the work to generate a request and parse the response. As soon as I type a character I get the expected auto-complete results displayed. When I backspace back to 0 chars it doesn't display anything, but it still does the AJAX request. There must be a place in prototype.js where there is a decision to render the html or not? I can't seem to find it. So I'm just looking for some hints on why that wouldn't happen sometimes.. On Mar 14, 11:27 am, pipplo joe.kos...@gmail.com wrote: I have a weird bug that I'm having trouble debugging. I am using Rails but I think the issue is in the javascript handling somewhere. I have a div with a form and autocomplete div id=form form info autocomplete box /form /div I have the options set so that when the user clicks in the auto- complete they get an initial list (minChars = 0) When the user types a user name in the autocomplete and selects one of the drop down options I generate a request via Ajax and render the form again without the autocomplete. The user can then click 'remove' to remove the user info and re-draw the autocomplete box. After the re-draw the minChars = 0 doesn't work. Whenever I click in the box I see a request generated to my controller, and I return the correct information but it doesn't get rendered into HTML and I dont see a drop down. If the user types a letter or name then the dropdown lits does show up, but the initial ajax request never gets reflected. I assume there is some state variable that thinks the text box hasn't changed value or something which is preventing actually rendering the HTML returned by Rails. I hope that makes sense. Any ideas? P.S. My current workaround is to just hide the autocomplete field and not render it empty. This works but won't be usable in other parts of my site. -- 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: Rails 3.1 - Prototype = WTF?
Another anecdote along with Jane's... i make a lot of comparisons to jQuery as well because it's the only other library i've gotten familiar with. i still really like Prototype's robust set of utility data storage functions. i get wary of storing data directly on elements [jQuery.data()] and sometimes it's simply not appropriate to do so, so having Prototype's pseudo-class structure to drive the overall functionality of a page is very helpful, because i can create class members and manage data there, rather than in the HTML area of the DOM. Classes really helped me build complex JS applications when i was still brand new to application-style Javascript AJAX. That said, Prototype is bloated, and doesn't play nice with others. Scriptaculous is old, just as bloated, and i think 1 or 2 lines of code have been updated in the last year, to provide Pt 1.7 compatibility. Plus Scriptaculous doesn't provide an actual UI, just some enhanced visual effects other tools. And you have to be careful of a lot of gotchas in those effects because Scriptaculous doesn't wrap your code into HTML object references that it will need to make those effects work. jQuery's UI does that. One of the bigger advantages of Scriptaculous is Builder. i much prefer creating HTML through a node/tree structure than slapping an HTML string into an element. However, someone went and built a jQuery plugin to do what Builder does. /shrug i've noted elsewhere in this group that i don't like that there are several aliases for many of Prototype's functions, most of which are unnecessary Rails translations for otherwise sensible names. i get that it's supposed to help Rails devs use Prototype efficiently, so why not just keep only the Rails versions of functions and drop the aliases? jQuery tends to provide one way to do a lot of things. Prototype tends to provide a lot of ways to do one thing. i didn't like jQuery at first for all the reasons i stated above for liking Prototype. Once i got the hang of the major differences slight syntax variations, i've found it to really save time in a lot of ways. Granted, i also haven't built any huge application-level code using jQuery yet, but i feel like i could now that i understand the inner workings better. Jane mentioned event handling. i can go either way with that. Prototype's Function#bind makes it easy to incorporate the Class object into an event handler, but you lose context of the element unless you use Event#findElement. And i really like Event#on, but haven't done any heavy lifting with Prototype since 1.7 was released. So jQuery's handlers work fine for me. i've also never developed with Rails, and maybe because of that i don't feel a particular loyalty. i want the right tool for the job at hand, and lately that has been jQuery. Especially the ease of using plugins for missing functionality, and the UI library which amazes me. But to address your actual question: Why has traffic died down in this group? My personal observation would be that jQuery has simply gained traction over the last couple years. Prototype... i don't know. Kinda feels stale, neglected, and maybe a bit stuck in its ways? It seems like there's a lot of push to make JS libraries cooperate with each other so you can get the best each has to offer, yet Prototype can't get itself away from modifying native objects, which forces everyone else to provide safety schemes to accommodate. Also, where most libraries provide compression-safe code, Prototype stays pretty rotund at ~160K. Add Scriptaculous and you can hit 1MB of library before you get to any of your own code. In spite of criticisms, i don't want this to feel like a slam against Prototype. Obviously i still get something out of it or i'd drop my subscription to the groups. But you ask why the traffic has slowed to a crawl, and that's my opinion: Prototype itself has also slowed down. Check the dev group if you don't believe me (http://groups.google.com/ group/prototype-core/topics?hl=engvc=2). Two legitimate threads with posts in 2011, and those being about bugs, not additional development. So there's my $0.02+... i feel your frustration, though. -joe t. On Mar 14, 1:53 pm, Walter Lee Davis wa...@wdstudio.com wrote: Sorry for the rant, but I came to Prototype by way of early exploration with Rails. I found Prototype approachable and learn-able in a way that I didn't (and don't) find jQuery to be. I've invested years in learning Prototype and it has trained and patterned my JavaScript brain. I'm quite cheesed about the notion of having to learn another way to look at JavaScript. At the same time, I can't help but notice the crickets around here lately. When I joined this list (back in the rails-spinoff days) there were dozens of posts per day, now we're lucky to get there in a week. What the heck is going on here? Walter -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group
[Proto-Scripty] Re: event on leaving page
Here's a sample from code that i wrote and seems to work ok (at least, last i tested it, i no longer work there), adapted for generics: http://pastie.org/1661648 So here's what i learned, now that my curiosity got roused... The beforeunload event will automatically generate the prompt. If you want to inject a custom message into that prompt (not speaking for FF4, as i haven't tested on that with my prior code), you assign that STRING to the event.returnValue property. i'm pretty sure that by assigning a value to event.returnValue, the prompt is fired. If it has no value by the time the handler returns, the prompt does not occur. The user is prompted with the built-in prompt, plus your custom message. The event will automatically cancel ITSELF if the user hits the Cancel button of the confirmation message. There's no need to put a confirm in the event handler yourself. That's what would cause the double-prompt, and the confirm you generate is ignored by the event anyway. That's the best i can recall, anyway. i hope it helps. -joe t. On Mar 11, 9:29 am, Walter Lee Davis wa...@wdstudio.com wrote: On Mar 11, 2011, at 7:41 AM, Bertilo Wennergren wrote: Here's a limitation with beforeunload (in case someone hasn't heard): More of less the only thing you can do with beforeunload, is to ask the user if he or she really wants to leave the page. A dialog will appear, and the user can choose to abort the unloading and stay on the page. Normally you can add your own text to this dialog, informing why it might be wise not to leave the page. In Firefox 4 this is no longer possible! The dialog will have the following canned text that you cannot change (it might be in another language though): This page is asking you to confirm that you want to leave - data you have entered may not be saved. That's what the dialog will say in Firefox 4. You can't change it, and you can't add anything to it. If the reason for using beforeunload does not have anything to do with entered data, or if you'd like to inform the user precisely what kind of data would be lost, or where on the page it is to be found, or why it's would be so bad to lose it, you're out of luck. This is all by design. -- Bertilo Wennergren berti...@gmail.comhttp://bertilow.com Thanks, this is very interesting. I just tested with the following bit of code: document.observe('dom:loaded',function(){ Event.observe(window,'beforeunload',function(evt){ evt.stop(); if (confirm('Are you sure you want to close the window?')) return true; }); }); In Safari, I got what I expected -- my confirm dialog blocking the window close. But in Firefox 3.latest, I got two dialogs. First was my confirm, but when I okayed that I got the second, which was more or less exactly the same as what you describe for FF4. I commented out the confirm line, and got only the one alert, but then in Safari I got no warning at all. I wonder if there's any way besides browser sniffing to work around this double-warning? Walter -- 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: event on leaving page
One note on TJ's post, hopefully helpful: You cannot CANCEL the unload event. If i understand them correctly, load and unload are the only native events that can't be canceled from scripts. You can perform other actions, but unload means the browser has been committed to unloading that page, regardless what else it's told to do at that point. The point of no return to let the user cancel the unload is beforeunload (handy, and a Microsoft creation, ironically). And to his point, he's correct: about the only other actions you can take are cleanup/garbage collection. Not that it would matter anyway if you create new content, the page is going bye-bye. :) That all comes from a painful two weeks a few years ago before i knew about beforeunload. Still bitter at myself over that. -joe t. On Mar 10, 9:31 am, Walter Lee Davis wa...@wdstudio.com wrote: On Mar 10, 2011, at 2:25 AM, T.J. Crowder wrote: What you can do in those functions is severely limited by modern browsers (for all the good reasons you can think of). You can't open new windows, do alerts/confirms Thanks. This is the part I was remembering -- someone wanted an Are You Sure to interrupt closing the window on a running process, and I mistook the answer to mean that onunload couldn't do much of anything, versus 'couldn't do much of anything to the current window'. That makes perfect sense now. Walter -- 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: Element.update not working with div inside a table
Yay! i learned my HTML tip-of-the-day: multiple TBODY tags! Now, i'm off to find an excuse to use it. -joe t. On Feb 16, 12:38 pm, T.J. Crowder t...@crowdersoftware.com wrote: Hi, For some reason never learned about the tbody element. When did that get added to the spec Proposed in 1996, standardized in HTML 4.01 in 1999.[1] It's a cool element, because amongst other things, you can have more than one of them. So if you have a table with rows you want to replace and other rows you don't, you can put them in separate TBODYs and group them that way. AFAIK, it's always been optional (officially optional) in the *markup* (it certainly is in HTML5), but that's in the markup; in standards mode, browsers have been inserting it in the DOM for you for years. For example:http://jsbin.com/urito5If you run that on IE6, IE7, IE8, Chrome, Firefox, or Opera, they'll all say the only child element of the TABLE element is a TBODY, although there's no TBODY in the markup. Interestingly, HTML5 seems to allow TR to be a direct child of TABLE, even in the DOM[2]. That surprises me, I thought it was just in the list of elements that an engine was meant to infer.[3] I'm probably just misreading the spec. I always explicitly include TBODY if there's any chance I'm going to need to manipulate the DOM at the table level, just so I know where I am even on edge browsers. 1:http://www.w3.org/TR/html4/struct/tables.html#edef-TBODY 2:http://www.w3.org/TR/html5/tabular-data.html#the-table-element 3:http://www.w3.org/TR/html5/syntax.html#optional-tags Best, -- T.J. Crowder Independent Software Engineer tj / crowder software / com www / crowder software / com On Feb 16, 4:37 pm, Jeffrey Lee jlee...@gmail.com wrote: That will teach me to rely on google and random discussions online. :) I was suspicious that the div was in an awkward location, but hadn't come up with a good way to replace just the body of the table. For some reason never learned about the tbody element. When did that get added to the spec, or has that always been there and just not used by hacks like me? Granted the last time I spent any energy on creating and editing web pages before this year was in the late 90's. ___ Jeffrey Leehttp://www.jeffreyalanlee.com jlee...@gmail.com On Feb 16, 2011, at 8:28 , Walter Lee Davis wrote: Not in my memory of HTML, which begins in 1997. It's certainly possible to put that into a browser and see something. Browsers are designed to ignore or coerce invalid code as best they can, to preserve the intent where possible. But there's a mile of difference between the JavaScript DOM interpreter and the browser's HTML display engine. JavaScript doesn't even receive the HTML as written in code from the browser when it's constructing its starting DOM tree, it uses the output of the browser's first pass at munging the input code stream into shape. This is why you can see a big difference between Firebug and view source, for example. So whenever you are interacting directly with the DOM, as you do in Prototype Element#update or anything else that inserts elements into the DOM, you are relied on to insert something that makes sense in the context where it will be added. If you don't, you get an error or you get ignored. One other example of this, directly related to tables: It's perfectly valid code to write table id=footrtdSomething/td/tr/table, but it's more correct to write table id=footbodytrtdSomething/td/tr/tbody/table. Most browsers will silently add that missing intermediate element when the page loads. So if you wanted to get a handle on your first row, and you used $('foo').childElements()[0] (totally made-up example) then you might actually get a reference to the tbody -- the element you didn't actually code! Now you're probably smarter than that, and you'd write $('foo').down('tr') and get what you wanted, but that's just an example to make the point that the code you wrote isn't even guaranteed to be the code you're going to be talking to when you start messing with the DOM. Walter On Feb 16, 2011, at 10:15 AM, Jeffrey Lee wrote: Shows how outdated my HTML is. Thanks for the pointer. Its funny, when I was googling around apparently once upon a time it was at least tolerated, if not officially acceptable, to have div as a child of table. ___ Jeffrey Lee http://www.jeffreyalanlee.com jlee...@gmail.com On Feb 15, 2011, at 23:20 , T.J. Crowder wrote: Hi, That HTML is invalid. You can't have a `div` as a child of `table`: http://www.w3.org/TR/html5/tabular-data.html#the-table-element If you want to subdivide a table like that, you probably want `thead` (for your headers) and one or more `tbody` elements: table thead tr thItem
[Proto-Scripty] Re: Using Prototype
Expanding somewhat on T.J.'s point, i definitely couldn't work without Prototype's data management utilities (Enumerable, Object extensions, etc). i love jQuery's compactness and efficiency, but with almost no attention to Javascript data, i'd rather sacrifice it's DOM efficiency to have Prototype's data/object manipulation skills. For lightweight websites that don't require a lot of local data treatment, i'll use jQuery because it's fairly easy to get used to, and compact. For anything where i'm retrieving server data or managing data within the client for an app, i stick to Prototype, and i've rarely had occasion for them to overlap. Just my thoughts. It's not a blog, i know, but since you asked... :) joe t. On Jul 6, 12:39 am, P.J. pjfontil...@gmail.com wrote: Thanks T.J. The Language section is definitely a prime example of an area Prototype excels at where jQuery does little in. My aim is to use both libraries in a manner that complements each other. Just looking for positive reinforcement in that idea; looking for specific strengths each library has. On Jul 5, 2:15 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi, Just generally speaking, but: If you go to the API reference[1], most things in the Language section fall into the category of things Prototype provides that jQuery doesn't. jQuery has $.each, but most of the other stuff in Prototype's Enumerable isn't in jQuery. I _think_ Prototype 1.7 (currently at RC2) has better support for querying the layout of elements than jQuery does -- for instance, finding out the current pixel value of an auto margin. [1]http://api.prototypejs.org/ FWIW, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Jul 4, 6:24 pm, P.J. pjfontil...@gmail.com wrote: Hi guys, First off, here's a reference I'd like you to read so you'll understand where I'm coming from.http://jqueryvsmootools.com/ It's written by Aaron Newton and it's about jQuery and MooTools. Short and sweet, jQuery focuses on the DOM, and does a pretty good job with it; and MooTools focuses on the entire JavaScript language. Aaron's MooTools is my Prototype. I have a library that uses both jQuery and Prototype. I'm not using Scriptaculous as jQuery can handle most of the UI. I've been using Prototype to parse JSON and retrieve data from external sources, and always consider using it first when I come across something difficult to code. I have both in my library because I wanted to be able to use widgets for both, thus netting me a large variety of widgets and functionality from both camps. Should I be treating Prototype similar to how Aaron views MooTools? As an extension of the entire JavaScript language as a whole? Does anyone have any examples of situations where Prototype provides functionality that jQuery doesn't? Mainly, anything outside the UI. jQuery also supports JSON usage, but by using Prototype I can not only parse JSON but XML and other arbitrary data types as well. I wish to re-evaluate my decision to use both in one library, especially if one of my reasons was the usage of plugins from both camps and the other was that Prototype and jQuery serve different purposes. Please help me out, I always attempt to contribute my findings back to the community and would greatly appreciate it. -- 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-scriptacul...@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: morph effects on menu roll-over.. better way?
Did you examine the Queue section of the script.aculo.us website? http://wiki.github.com/madrobby/scriptaculous/effect-queues i don't use the animation library that much, so i can't offer much help. Sorry. Animations are nice, but in my mind, they're more often a waste of CPU cycles to an otherwise streamlined application. Maybe if animations become part of the core functionality of HTML or CSS that'll improve. i can see the usefulness, just not very often in my work does it apply. Hope that queue page offers some help though. -joe t. On Jul 4, 4:31 pm, Matt matthew.jones...@gmail.com wrote: I tried putting the morph calls in parallel and it really just changed the responsiveness of the rollover affect making it more 'stiff' and less fluid when multiple menu items were selected in succession. The affect i am trying to get it achieved by my first script (currently running on the test page), the only problem is it seems that the computer loses track of which order the morphs are called in. ex: when new morphs are called on dividers already in a morph process, it seems to overwrite the current morph with the new one, the new morph completes, then the divider flashes white as if it was still running the original morph command in the background and you just see the final result after the secondary overwriting morph has finished. im not sure if this is actually what is going on, its just the best way i can think of to explain the situation. it almost seems like a queue is required to ensure that the morphs complete in the proper order, and are canceled and re-ordered as the menu item selection changes, or maybe just canceling the previous morph on an element before ordering the new one (if that is not automatically done by javascript).. any one have any ideas/experience working with complex multiple morphing situations like this, or perhaps offer an alternative to using morph to complete the effect i want to achieve.. thanks -- 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-scriptacul...@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: Proper error handling
Oh thank god. i thought i was being incredibly dense using a solution like that. But having seen no other way to determine the procedural path to take when the server responds (barring a transport error), that seems the most effective way to follow one route for successes and another for failures/errors. Would be interested in seeing some tips for that wrapper magic. ;) -joe t. On Jun 22, 2:45 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi, On Jun 21, 9:58 pm, Jason 'XenoPhage' Frisvoldxenoph...@godshell.com wrote: [snip] What about a non-HTTP error? What if, for instance, myId was invalid? What is the proper way to pass that information back to the ajax application? Is it ok to use a custom 4xx error? Or should I be using JSON or XML to handle this? The answer is in the question. :-) If it's a non-HTTP error, it wouldn't be best practice to use an HTTP error code to represent the error. (Not that HTTP status codes don't have a fair bit of scope creep in them already.) I've standardized by having *all* of my Ajax calls return data in the same way. They all return JSON-formatted data, and the format for success is always: { success: true, otherdata: here } and the format for errors is always: { success: false, errMessage: error message here } In any given application, I tend to have a wrapper around Prototype's ajax stuff with some problem-domain logic in it. That wrapper always checks for the `success` flag on calls and routes to the error handler if it's not there. FWIW, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com -- 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-scriptacul...@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] Canceling a custom effect using click or mousewheel
Hi All, I'm a fairly new prototype and scriptaculous user with limited javascript experience. I have been developing with Ruby on Rails for some time, and found I needed to automatically scroll to the bottom of a div as part of a series of animated effects. Since Effect.ScrollTo only affects the whole document, I copied the custom Effect.Scroll from http://pastie.org/36461, and modified it to allow scrolling to the bottom of the element. I have created an extensions.js file and put the custom effect in there, and it runs fine. So here's my situation. I need users to be able to stop the scroll either by clicking inside the element, or using their mousewheel on it. I've read a bunch of documents, including the tips and how-tos on hooking events at proto-scripty.wikidot.com, and all seem to indicate that something sort of like this is in order: Event.observe(element, 'click', someFunctionThatStopsTheEffect) Event.observe(element, 'mousewheel', someFunctionThatStopsTheEffect) Questions: 1) Is 'mousewheel' a standard event? If not, what is the correct way to access mouse wheel behavior? 2) Can I embed these observers directly into the custom effect? If so, what is the proper location (initialize, setup, or update) where they should reside? 3) If they can go into the custom effect, what's the proper way to handle the function call? Could I do something like this: Event.observe(element, 'click', function() { this.cancel(); }) 4) Or, is there some better way to do this entirely? Thanks so much for any help you can offer. Here is the code for my version of Effect.Scroll: Effect.Scroll = Class.create(); Object.extend(Object.extend(Effect.Scroll.prototype, Effect.Base.prototype), { initialize: function(element) { this.element = $(element); var options = Object.extend({ x:0, y:0, to_bottom: null, mode: 'absolute' } , arguments[1] || {} ); this.start(options); }, setup: function() { if (this.options.continuous !this.element._ext ) { this.element.cleanWhitespace(); this.element._ext=true; this.element.appendChild(this.element.firstChild); } this.originalLeft=this.element.scrollLeft; this.originalTop=this.element.scrollTop; if (this.options.to_bottom) { this.options.y = this.element.scrollHeight; } if(this.options.mode == 'absolute') { this.options.x -= this.originalLeft; this.options.y -= this.originalTop; } else { } }, update: function(position) { this.element.scrollLeft = this.options.x * position + this.originalLeft; this.element.scrollTop = this.options.y * position + this.originalTop; } }); -- 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-scriptacul...@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: Canceling a custom effect using click or mousewheel
OK, so I solved the problem I think. I created a queue called 'dialogue' in the call to Effect.Scroll, and then put the following code in my Rails application.js file: Event.observe(window, 'load', function() { Event.observe($('dialogue_window'), 'click', function() { Effect.Queues.get('dialogue').invoke('cancel'); }) Event.observe($('dialogue_window'), 'mousewheel', function() { Effect.Queues.get('dialogue').invoke('cancel'); }) Event.observe($('dialogue_window'), 'DOMMouseScroll', function() { Effect.Queues.get('dialogue').invoke('cancel'); }) }); This keeps the custom effect and the observer/handler code separate, which seems right. It also appears to have the desired effect, at least in FF3. I'll test it in other browsers tomorrow, but before I do, does this approach seem reasonable? -- 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-scriptacul...@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: Getting the value of a form field
Similar to a prior response using a CSS selector, but eliminating the call to #find: // Returns single value of the checked radio var value = $F($$('input:checked[type=radio][name=groupName]')[0]) The :checked pseudo-class shortcuts to the checked element(s) in the selector results. However, in a checkbox group, this would suit better: // Returns an array of values of checked boxes var values = $$('input:checked[type=checkbox][name=groupName\ [\]]').pluck('value'); Note the escaped square brackets are how server languages like PHP generate arrays from multiple checkboxes. i really wish when dealing with forms, Prototype's functions dealing with values should address the name instead of the id, since this is also the attribute that servers deal with to identify values. Especially when you're forced to use expensive methods like the above to use a CSS selector, create an array of matches (pointless when you know there's only one resulting element), and then get its value. Hope that's useful. -joe t. On Apr 30, 1:32 pm, Shane McCarron halindr...@gmail.com wrote: I am sure this is just ignorance on my part, but... I would really like to $F('formField') to get the value of whatever field I am interested in. However, it seems formField needs to be the field's ID, not its Name. That's cool, except when I have Radio Buttons or Check Boxes. You aren't allowed to have multiple elements with the same ID and still be valid. What's the right way to do this? -- Shane McCarron halindr...@gmail.com -- 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-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/prototype-scriptaculous?hl=en. -- 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-scriptacul...@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: Proposal: Alias clearContent for update()
Admittedly, there are methods in Prototype (and any library) which are not perfectly intuitive because they can serve multiple purposes for the sake of condensing code. i personally see the update() method as suitable. When there's an argument, you're updating with the content in the argument. When there's none, you're updating the element to empty content. There are a lot of aliases in the Prototype library as it is - something i see more often as a confusing eyesore than a help. If you really want to propose the alias to the core, though, join the Prototype Core group and toss it out there, see if it sticks. -joe t. On Apr 12, 9:01 am, Rüdiger Plantiko ruediger.plant...@astrotexte.ch wrote: Hi, I didn't find a method for clearing the content of an HTML element *and* which from its name clearly indicates this action. I formerly used $(myContainer).update() for clearing the element's content, i.e. calling the update method with no arguments. But I prefer a readable alias like Element.clearContent() for this. (I first tried an alias Element.clear() but this wasn't a good idea, the function clear seems to be reserved for other things). I like to propose such an alias for the Prototype standard. Regards, Rüdiger -- 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-scriptacul...@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: Scrodicator: a javascript indicator while you scroll through your form or page
Not me. i snickered. Brings images of The Terminator as an adult film to mind. :) -joe t. On Mar 21, 8:04 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi, I can change the name from scrodicator to scrolldicator, if it sounds more polite to native English speakers. It does to *this* native speaker; I can't speak for everyone. Hopefully other people are more mature. :-) -- T.J. On Mar 21, 10:15 am, green greenlaw...@gmail.com wrote: Hi Mr. T.J.Crowder I really don't get you on FWIW, and it's likely just the 13 year-old boy in me. But anyway thanks for the naming suggestion, I can change the name from scrodicator to scrolldicator, if it sounds more polite to native English speakers. Yes I am going to create a demo page in the github wiki. As for now, people can download the package and open sample html files for a demo. Thx, Green On Sun, Mar 21, 2010 at 9:05 PM, T.J. Crowder t...@crowdersoftware.comwrote: Hi, I have publish a UI control named scrodicator... FWIW, and it's likely just the 13 year-old boy in me, but scrodicator sounds vaguely crude to (this) native English speaker... Perhaps scrolldicator? Hi, I've created a video clip to demonstrate what scrodicator is. Why not just create a demo page? Just curious... -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Mar 20, 10:27 pm, green greenlaw...@gmail.com wrote: Hi, I've created a video clip to demonstrate what scrodicator is. You can find it athttp://www.youtube.com/watch?v=rYkgrCsN52c On Sun, Mar 21, 2010 at 1:12 AM, Walter Lee Davis wa...@wdstudio.com wrote: Is there a demo anywhere? It looks interesting, but I'm not immediately sure what you mean it does. I don't use Gmail, so I haven't seen the example you reference. Walter On Mar 20, 2010, at 9:42 AM, green wrote: Hi I have publish a UI control named scrodicator at http://github.com/greenlaw110/lgl_ui. Scrodicator is facilitated by gmail which design a visual indication show the next email sender in a long mail loop. This control is licensed in MIT license. Comments are welcome. Thx, Green -- 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-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculou s%2bunsubscr...@googlegroups.comprototype-scriptaculou s%2bunsubscr...@googlegroups.com s%252bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- 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-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculou s%2bunsubscr...@googlegroups.comprototype-scriptaculou s%2bunsubscr...@googlegroups.com s%252bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- 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-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculou s%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- 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-scriptacul...@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: for...in gets a overflow if including scriptaculous and prototype ?
TJ, i see endless warnings against using for/in. And i understand the reasons for them, especially on arrays. But it seems like a fairly powerful looping tool, yet no one seems to temper the warnings with appropriate circumstances for its use. Since the JS spec disallows creating non-enumerable properties, ARE there any good uses for this loop method? Thanks, -joe t. On Feb 22, 9:08 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi, That for..in code is incorrect, based on a misconception (a common one). This page explains the misconception and discusses correct ways of iterating through arrays:http://proto-scripty.wikidot.com/prototype:tip-looping-through-arrays HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Feb 22, 12:13 pm, Dale daniel.lehtovi...@gmail.com wrote: Hi I tried a simple javascript example on the w3school (http://www.w3schools.com/JS/js_loop_for_in.asp), and the example works fine if I don't include scriptaculous or prototype, but once I do I keep getting a strange error. Anyone know why this error/bug shows up, or have I done something very strange in my code ? Thanks for any help... examples below... The normal example: html body script type=text/javascript var x; var mycars = new Array(); mycars[0] = Saab; mycars[1] = Volvo; mycars[2] = BMW; for (x in mycars) { document.write(mycars[x] + br /); } /script /body /html Output of this one is: Saab Volvo BMW The modified example including the library: html head script src=javascript/prototype.js type=text/javascript/script script src=javascript/scriptaculous.js type=text/javascript/ script /head body script type=text/javascript var x; var mycars = Array(); mycars[0] = Saab; mycars[1] = Volvo; mycars[2] = BMW; for (x in mycars) { document.write(mycars[x] + br /);} /script /body /html Output of this one is: Saab Volvo BMW function each(iterator, context) { var index = 0; try { this._each(function (value) {iterator.call(context, value, index+ +);}); } catch (e) { if (e != $break) { throw e; } } return this; } function eachSlice(number, iterator, context) { var index = - number, slices = [], array = this.toArray(); if (number 1) { return array; } while ((index += number) array.length) { slices.push(array.slice(index, index + number)); } return slices.collect(iterator, context); } function all(iterator, context) { iterator = iterator || Prototype.K; var result = true; this.each(function (value, index) {result = result !!iterator.call(context, value, index);if (!result) {throw $break;}}); return result; } function any(iterator, context) { iterator = iterator || Prototype.K; var result = false; this.each(function (value, index) {if ((result = !! iterator.call(context, value, index))) {throw $break;}}); return result; } function collect(iterator, context) { iterator = iterator || Prototype.K; var results = []; this.each(function (value, index) {results.push(iterator.call(context, value, index));}); return results; } function detect(iterator, context) { var result; this.each(function (value, index) {if (iterator.call(context, value, index)) {result = value;throw $break;}}); return result; } function findAll(iterator, context) { var results = []; this.each(function (value, index) {if (iterator.call(context, value, index)) {results.push(value);}}); return results; } function findAll(iterator, context) { var results = []; this.each(function (value, index) {if (iterator.call(context, value, index)) {results.push(value);}}); return results; } function grep(filter, iterator, context) { iterator = iterator || Prototype.K; var results = []; if (Object.isString(filter)) { filter = new RegExp(RegExp.escape(filter)); } this.each(function (value, index) {if (filter.match(value)) {results.push(iterator.call(context, value, index));}}); return results; } function include(object) { if (Object.isFunction(this.indexOf)) { if (this.indexOf(object) != -1) { return true; } } var found = false; this.each(function (value) {if (value == object) {found = true;throw $break;}}); return found; } function include(object) { if (Object.isFunction(this.indexOf)) { if (this.indexOf(object) != -1) { return true; } } var found = false; this.each(function (value) {if (value == object) {found = true;throw $break;}}); return found; } function inGroupsOf(number, fillWith) { fillWith = Object.isUndefined(fillWith) ? null : fillWith; return this.eachSlice(number, function (slice) {while (slice.length number) {slice.push(fillWith);}return slice;}); } function inject(memo, iterator, context) { this.each(function (value, index) {memo = iterator.call(context, memo, value, index);}); return memo; } function invoke(method) { var args = $A(arguments).slice(1); return this.map(function
[Proto-Scripty] Re: element.observ on classname+id
Ugh. Looks like more slacker accommodation to me. The p tag laziness alone looks like layout problems begging to happen (especially for JS string-to-HTML parsing). But thanks for pointing out that technicality. Not sure i understand why they're allowing for it. -joe t. On Feb 21, 1:57 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi Joe, Just as a small nit-pick, LI elements are containers, and so should have closing /li tags. Browser behavior for years has made doing what he did functional, and the HTML5 spec will actually formalize it:http://dev.w3.org/html5/spec/syntax.html#optional-tags I only realized that the other day, when I was looking up something about the TH element and the example flagrantly omitted end tags all over the place. Fortunately, the end tag is still *allowed*, it's just optional in certain defined situations. -- T.J. On Feb 21, 12:27 am, joe t. thooke...@gmail.com wrote: Just as a small nit-pick, LI elements are containers, and so should have closing /li tags. -joe t. On Feb 20, 8:58 am, Jinsa jf.wesq...@gmail.com wrote: Hi everybody! I'm actually working on a script acting on a UL menu with different LI classname. The goal is to react onMouseOver and onClick on each LI click or mouseover differently. The fact is the class is unknown so my script have to check the UL and then observe each LI as elements. Here is the html: ul id=menu li class=itema id=current href=First/a li class=item23a id=current href=Second/a li class=item22a id=current href=Third/a li class=item12a id=current href=Vador/a li class=item6a id=current href=What the!/a li class=item2a id=current href=Hahum!/a /ul and then the script: function bindage() { $('menu').down('li').each(function (el) { return $(el).observe('click', function(event) { event.stop(); alert('hellow bro'); }); }); } Event.observe(window, 'load', bindage); But that obviously doesn't work... I really don't have any idea to make it work... I've tried so far but without any success... maybe you could help me? Thanks, JF. -- 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-scriptacul...@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: element.observ on classname+id
Just as a small nit-pick, LI elements are containers, and so should have closing /li tags. -joe t. On Feb 20, 8:58 am, Jinsa jf.wesq...@gmail.com wrote: Hi everybody! I'm actually working on a script acting on a UL menu with different LI classname. The goal is to react onMouseOver and onClick on each LI click or mouseover differently. The fact is the class is unknown so my script have to check the UL and then observe each LI as elements. Here is the html: ul id=menu li class=itema id=current href=First/a li class=item23a id=current href=Second/a li class=item22a id=current href=Third/a li class=item12a id=current href=Vador/a li class=item6a id=current href=What the!/a li class=item2a id=current href=Hahum!/a /ul and then the script: function bindage() { $('menu').down('li').each(function (el) { return $(el).observe('click', function(event) { event.stop(); alert('hellow bro'); }); }); } Event.observe(window, 'load', bindage); But that obviously doesn't work... I really don't have any idea to make it work... I've tried so far but without any success... maybe you could help me? Thanks, JF. -- 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-scriptacul...@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: How to observe the event window.resize ?
Try Event.observe(window, 'resize', ...); (similar to the 'dom:loaded' pseudo-event) However, per a jQuery discussion here: http://stackoverflow.com/questions/641857/javascript-window-resize-event and here: http://noteslog.com/post/how-to-fix-the-resize-event-in-ie/ it might not be so wise to observe the event directly. IE fires the event each time a pixel move is made. You could probably adapt code out of the latter link, though. -joe t. On Jan 18, 12:33 pm, gillesvds gilles...@adok.info wrote: Hello, How to observe the event window.resize with prototype ? The window object is not an instance of Element... so, is there a cross-browser solution using prototype ? Thanks, Gilles (France) -- 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-scriptacul...@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: Collecting checked checkboxes
Couldn't this also work (tweak to fit)?: var values = $('containerID').select('input:checked[type=checkbox] [name=checkGroup[]]').pluck('value'); i use that line for radio groups. Got it from: http://stereointeractive.com/blog/2008/06/05/get-radio-button-value-using-prototype/ -joe t. On Jan 11, 6:38 am, Alex McAuley webmas...@thecarmarketplace.com wrote: I use something like this .. var array=new Array(); $$('.myClassName').each(function(e){ if(($e).checked==true) { array.push($(e).value); } }); where input type=checkbox class=myClassName value=I am checked / HTH Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: Hussein B hubaghd...@gmail.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Monday, January 11, 2010 8:11 AM Subject: [Proto-Scripty] Collecting checked checkboxes Hey, I have a checkbox in front of each row in my table. Upon clicking on submit button, I want to collect the checked boxes and send values via Ajax request. How to iterate over the checked boxes? Thanks for help and time. -- 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-scriptacul...@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. -- 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-scriptacul...@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: Collecting checked checkboxes
Er, a boo-boo on my part when compared to the source... He uses $$() to directly select the checkboxes, rather than starting at the parent container and using select(). i imagine it would work either way, but the original $$() is one step more direct. -joe t. On Jan 11, 7:36 pm, joe t. thooke...@gmail.com wrote: Couldn't this also work (tweak to fit)?: var values = $('containerID').select('input:checked[type=checkbox] [name=checkGroup[]]').pluck('value'); i use that line for radio groups. Got it from:http://stereointeractive.com/blog/2008/06/05/get-radio-button-value-u... -joe t. On Jan 11, 6:38 am, Alex McAuley webmas...@thecarmarketplace.com wrote: I use something like this .. var array=new Array(); $$('.myClassName').each(function(e){ if(($e).checked==true) { array.push($(e).value); } }); where input type=checkbox class=myClassName value=I am checked / HTH Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: Hussein B hubaghd...@gmail.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Monday, January 11, 2010 8:11 AM Subject: [Proto-Scripty] Collecting checked checkboxes Hey, I have a checkbox in front of each row in my table. Upon clicking on submit button, I want to collect the checked boxes and send values via Ajax request. How to iterate over the checked boxes? Thanks for help and time. -- 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-scriptacul...@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. -- 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-scriptacul...@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: Collecting checked checkboxes
Ah, a little more tricky. Assuming: tr tdinput type=checkbox name=groupName[]//td tdCell 1/td tdCell 2/td tdCell 3/td /tr -SCRIPT- var values = []; $$('input:checked[type=checkbox][name=groupName[]]').each( function(el){ value.push(el.up().next(1).nodes[0]); } ); i don't really know if Prototype provides a clean Get the text content of this element method, since IE likes innerText and Firefox (i think) doesn't. This sample just assumes that the first node of the second cell with content is text (remember, index 0 when DOM navigating, so next(1) moves two cells). -joe t. On Jan 11, 8:03 am, Hussein B hubaghd...@gmail.com wrote: Thanks, it works for me. I have one further question: As I said, there is a checkbox at the end of each row. Now I know how to now if the checkbox is checked or not. What I want to do is if the checkbox is checked, I want to get the value of the second cell in the table. ID | NAME | DATE | STATUS | CHECKBOX How to do this? Sorry but I'm a client side developer usually, but I have this task to done. Thanks again. On Jan 11, 1:38 pm, Alex McAuley webmas...@thecarmarketplace.com wrote: I use something like this .. var array=new Array(); $$('.myClassName').each(function(e){ if(($e).checked==true) { array.push($(e).value); } }); where input type=checkbox class=myClassName value=I am checked / HTH Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: Hussein B hubaghd...@gmail.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Monday, January 11, 2010 8:11 AM Subject: [Proto-Scripty] Collecting checked checkboxes Hey, I have a checkbox in front of each row in my table. Upon clicking on submit button, I want to collect the checked boxes and send values via Ajax request. How to iterate over the checked boxes? Thanks for help and time. --- - -- 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-scriptacul...@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. -- 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-scriptacul...@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: Passing the content of an array in a form
For most typical cases, JSON is easier, and more efficient. For one, by sending a Content-type header of application/json you can send an array down from the server, and Prototype automatically converts it into a JSON object you can utilize. Hope that's helpful. There are much better explanations in the API documentation, and people here in the group who can articulate it much better than i. -joe t. On Dec 21, 2:59 am, Frédéric f...@gbiloba.org wrote: On lundi 21 décembre 2009, joe t. wrote: i may be misunderstanding the problem you're describing, but typically when you submit an array of values with the same field name, you want to use [] on the end of the field name. It's possible IE is submitting the array in its object form, which the server is seeing as string [object] and sending back untouched. If the fields are in your HTML, they need an attribute like: input ... name=picts[] / or if the data is managed by your script, and passed in the Ajax.Request as part of the parameters option, you still need to wrap the name into a string: { parameters: { picts[] : picts ... } } Sorry if that's on the wrong track. Thanks for the explanation. I was wondering: a better solution is may be to use json? What do you sthink about? -- Frédéric -- 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-scriptacul...@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: Ajax.Request
function show(){alert(get_data_default());} This line will fail when you call show() because you're not passing a function to fill the callback variable inside get_data_default(). Also, method:post and asynchronous:true are the defaults for those options. You don't need to specify them if you plan to keep those settings. -joe t. On Dec 20, 10:47 pm, heeae csche...@gmail.com wrote: I will using this approach function get_data_default(callback){ new Ajax.Request('/adress', { method:'post', asynchronous:true, onSuccess: function(data){ callback(data.responseText.evalJSON (true); }, onFailure: function(){ alert('Something went wrong...') } }); } function show(){alert(get_data_default());} var data = null; function processData(obj){ data = obj; alert(data.abc); } if(data == null){ get_data_default(processData); }else{ alert(data.abc); } On Dec 20, 7:35 pm, kangur91 kangu...@gmail.com wrote: My code: function get_data_default() { new Ajax.Request('/adress', { method:'post', asynchronous:true, onSuccess: function(data){ return data.responseText.evalJSON (true); }, onFailure: function(){ alert('Something went wrong...') } });} } function show(){alert(get_data_default());} I want to function get_data_default return data recived from OnSucces function. How do that? -- 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-scriptacul...@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: Passing the content of an array in a form
i may be misunderstanding the problem you're describing, but typically when you submit an array of values with the same field name, you want to use [] on the end of the field name. It's possible IE is submitting the array in its object form, which the server is seeing as string [object] and sending back untouched. If the fields are in your HTML, they need an attribute like: input ... name=picts[] / or if the data is managed by your script, and passed in the Ajax.Request as part of the parameters option, you still need to wrap the name into a string: { parameters: { picts[] : picts ... } } Sorry if that's on the wrong track. -joe t. On Dec 20, 7:10 am, Frédéric f...@gbiloba.org wrote: Hi, I have a little problem. I want to give the content of an array to a new page through a form. The javascript code is: this._view.selectedPicts.setAttribute('value', picts); I retreive the content using mod_python: fields = util.FieldStorage(req) selectedPicts = fields['selectedPicts'].split(',') All works fine under Firefox and Safari/konqueror, but fails under IE8: Firefox: fields={'numAdherent': [Field('numAdherent', '20')], 'numEvenement': [Field('numEvenement', '2')], 'selectedPicts': [Field('selectedPicts', 'P4052858.JPG,PB135158.JPG,photo20-08-03_DSC5719net_redimensionner.jpg,_DSC0222.jpg,p1010005.jpg')]} IE8: fields={'numAdherent': [Field('numAdherent', '20')], 'numEvenement': [Field('numEvenement', '2')], 'selectedPicts': [Field('selectedPicts', '[object]')]} The strange thing is if I log 'picts' before sending the form, it is correct, even under IE8! console.debug(OrderingController._submit(): picts= + picts); Firefox: 2009-11-0 12:53:55,198::DEBUG::OrderingController._submit(): picts=P4052858.JPG,PB135158.JPG,photo20-08-03_DSC5719net_redimensionner.jpg,_DSC0222.jpg,p1010005.jpg IE8: JOURNAL : 2009-11-0 12:55:10,67::DEBUG::OrderingController._submit(): picts=P4052858.JPG,PB135158.JPG,photo20-08-03_DSC5719net_redimensionner.jpg,_DSC0222.jpg,p1010005.jpg So, why do I get the wrong string in my form field under IE8? What should I use instead of just 'picts'? Thanks, -- Frédéric -- 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-scriptacul...@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: Progressive update messages from single request
My crude-imentary tests are on my Win7 laptop using Wamp, which means mod_deflate. Work server is Cent, but i don't know whether it's got any compression modules enabled (i've tried with the admin, he slacks). -joe t. On Dec 12, 4:17 am, Alex McAuley webmas...@thecarmarketplace.com wrote: Joe. Are you using ob_gz_handler(); or mod_defalte / mod_gzip ? Also is it a winblows or *nix server Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: joe t. thooke...@gmail.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Saturday, December 12, 2009 2:24 AM Subject: [Proto-Scripty] Re: Progressive update messages from single request Alex, Thanks for the sample. i must be missing a piece somewhere though...http://pastie.org/739926 From that single Ajax.Request, the client delays, and after the PHP is done running, i get the complete output in one block. What i'd anticipated was that in each loop, the flush() would somehow send that output to the client where it could be used, then the next loop's flush would send another output to the client... If i'm understanding it, Ajax is a single-request-single-response. i can't output the current step a process is in as it happens. i can accumulate them, as your model shows, and dump that out as a log, of sorts. But in order to monitor progress of one request's processing on the server, a series of follow-ups have to get feedback which the original is providing on the side (as T.J. recommended). Unless i'm missing something, which would be great if you could help me fill that in. :) -joe t. On Dec 11, 3:29 am, Alex McAuley webmas...@thecarmarketplace.com wrote: in your ajax request file ?php ini_set('output_buffering',0); // make sure the output_buffering directive is not set high ob_start(); // before anything is echoed to the screen for($i=0;$i10;$i++) { echo('liPrinting Line '.$i.'/li'); ob_flush(); flush(); sleep(1); // sleep for one second } ? this will output a line every second for 10 seconds Hope this helps P.S if you use ob_gz_handler this may not work (untested using it) Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: joe t. thooke...@gmail.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Friday, December 11, 2009 1:00 AM Subject: [Proto-Scripty] Re: Progressive update messages from single request david: The buffer/flush path seems to be where this solution is heading. Don't ask me why, but iframes rub me the wrong way. With the evolving needs for more streamlined connections, iframes feel like soggy bandaids to me. Given they have a place where nothing else seems to work (Ajax-ish file uploads), but i'd prefer to steer away from them in this case if i can. TJ: That seems like a fairly solid idea. Same general concept of having a second request object checking in on progress that the server reports back, it just gets it from a relatively more reliable source (instead of $_SESSION). Alex: Could you elaborate a bit, or point me to where i can follow up on that? i'm intrigued, but i'm not deeply familiar with using the output buffer effectively. Thanks for the replies! -joe t. On Dec 10, 3:45 am, Alex McAuley webmas...@thecarmarketplace.com wrote: I noticed you were using PHP on the server side ... you can also use output buffering to achieve this in one request Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: T.J. Crowder t...@crowdersoftware.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Thursday, December 10, 2009 8:38 AM Subject: [Proto-Scripty] Re: Progressive update messages from single request Hi Joe, It seems to me the simple way to do this is have the first request initiate a process on the server that keeps running when the request completes; the request returns an indicator of the current status and an identifier for the action. Your subsequent requests supply the identifer, which allows the server- side page to check the progress of the ongoing work matching that ID and report back the (new) status. People use things like this for showing progress bars for file uploads without using Flash, that kind of thing. HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote: i think i've seen examples of this, but can't recall where, and could use some guidance. Obviously it's easy to handle a 1:1 Request/Response How can i do a true 1:many process? For instance: Client takes a single action which requires the server to perform 3 tasks: * Query database * Generate PDF * Generate email, attach PDF, and send How can i
[Proto-Scripty] Re: Autocompleter does not work in FireFox 3.5.5
U, right, sure, yeah, of COURSE i saw that... (didn't). i tend to agree with you on [not] placing the active script block at the end of the document and trusting it to work 100% of the time. Like you, i haven't seen any hard data on why NOT to, but just don't fully trust it. i don't see any obvious reason the script would be failing. Tracing back #clearWhitespace from Prototype, it only occurs in Autocompleter in the #onComplete callback. i don't use the class that much, so i'm not the best one to ask. i just happened across your initial response in my digest email. :O Sorry i couldn't be more help on this one. -joe t. On Dec 12, 6:05 am, T.J. Crowder t...@crowdersoftware.com wrote: Just tossing in: Alternately, the script block that has the active part can be placed at the end of the document, so the DOM elements are loaded by the time the browser reaches that script tag. I've never been comfortable relying on that. I've heard people say it, some of them even people who seem like they know what they're doing, but I've never been comfortable *relying* on it. I really should find (or do) some really robust tests, probably a point of ignorance for me. Good catch that his script block *is* at the end. If you can count on elements being in place at that point, any idea why it's failing? -- T.J. On Dec 12, 2:00 am, joe t. thooke...@gmail.com wrote: Always makes me eager to jump in and spend my time helping. ;-) Nice. Just tossing in: Alternately, the script block that has the active part can be placed at the end of the document, so the DOM elements are loaded by the time the browser reaches that script tag. You knew that, but OP maybe didn't. -joe t. On Dec 11, 11:02 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi, I have not really tried to debug this. Always makes me eager to jump in and spend my time helping. ;-) But the error is obvious enough in this case: You're trying to access the DOM from inline script, which won't work; the DOM doesn't exist when that script is executed. You need to use the window.load or dom:loaded event. document.observe('dom:loaded', function() { // Create the autocompleter }); HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Dec 11, 3:10 pm, mjk mj.kelle...@gmail.com wrote: The error must be coming from another method that retrieves 'element'. I have not really tried to debug this. Wondering if anyone else has had this problem, and how they remedied it. The HTML html head meta http-equiv=Content-Type content=text/html; charset=utf-8/ script type=text/javascript src=http://localhost:4402/author/js/ prototype.js/script script type=text/javascript src=http://localhost:4402/author/js/ effects.js/script script type=text/javascript src=http://localhost:4402/author/js/ controls.js/script style type=text/css div.autocomplete { position:absolute; width:250px; background-color:white; border:1px solid #888; margin:0; padding:0;} div.autocomplete ul { list-style-type:none; margin:0; padding:0;} div.autocomplete ul li.selected { background-color: #ffb;} div.autocomplete ul li { list-style-type:none; display:block; margin:0; padding:2px; height:32px; cursor:pointer;} /style /head body label for=inputAutotext:/label input type=text id=input name=input size=15 / div id=results class=autocomplete style=display: none; position:relative;/div script type=text/javascript var txtid = 'input'; var divid = 'results'; var server = 'http://localhost:8080/ewcmtestbed/autocomplete'; new Ajax.Autocompleter(txtid, divid, server, { tokens: ','}); /script /body /html The error: In prototype.js element is null The method: cleanWhitespace: function(element) { element = $(element); var node = element.firstChild; while (node) { var nextNode = node.nextSibling; if (node.nodeType == 3 !/\S/.test(node.nodeValue)) element.removeChild(node); node = nextNode; } return element; }, -- 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-scriptacul...@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: Autocompleter does not work in FireFox 3.5.5
Always makes me eager to jump in and spend my time helping. ;-) Nice. Just tossing in: Alternately, the script block that has the active part can be placed at the end of the document, so the DOM elements are loaded by the time the browser reaches that script tag. You knew that, but OP maybe didn't. -joe t. On Dec 11, 11:02 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi, I have not really tried to debug this. Always makes me eager to jump in and spend my time helping. ;-) But the error is obvious enough in this case: You're trying to access the DOM from inline script, which won't work; the DOM doesn't exist when that script is executed. You need to use the window.load or dom:loaded event. document.observe('dom:loaded', function() { // Create the autocompleter }); HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Dec 11, 3:10 pm, mjk mj.kelle...@gmail.com wrote: The error must be coming from another method that retrieves 'element'. I have not really tried to debug this. Wondering if anyone else has had this problem, and how they remedied it. The HTML html head meta http-equiv=Content-Type content=text/html; charset=utf-8/ script type=text/javascript src=http://localhost:4402/author/js/ prototype.js/script script type=text/javascript src=http://localhost:4402/author/js/ effects.js/script script type=text/javascript src=http://localhost:4402/author/js/ controls.js/script style type=text/css div.autocomplete { position:absolute; width:250px; background-color:white; border:1px solid #888; margin:0; padding:0;} div.autocomplete ul { list-style-type:none; margin:0; padding:0;} div.autocomplete ul li.selected { background-color: #ffb;} div.autocomplete ul li { list-style-type:none; display:block; margin:0; padding:2px; height:32px; cursor:pointer;} /style /head body label for=inputAutotext:/label input type=text id=input name=input size=15 / div id=results class=autocomplete style=display: none; position:relative;/div script type=text/javascript var txtid = 'input'; var divid = 'results'; var server = 'http://localhost:8080/ewcmtestbed/autocomplete'; new Ajax.Autocompleter(txtid, divid, server, { tokens: ','}); /script /body /html The error: In prototype.js element is null The method: cleanWhitespace: function(element) { element = $(element); var node = element.firstChild; while (node) { var nextNode = node.nextSibling; if (node.nodeType == 3 !/\S/.test(node.nodeValue)) element.removeChild(node); node = nextNode; } return element; }, -- 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-scriptacul...@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: Progressive update messages from single request
Alex, Thanks for the sample. i must be missing a piece somewhere though... http://pastie.org/739926 From that single Ajax.Request, the client delays, and after the PHP is done running, i get the complete output in one block. What i'd anticipated was that in each loop, the flush() would somehow send that output to the client where it could be used, then the next loop's flush would send another output to the client... If i'm understanding it, Ajax is a single-request-single-response. i can't output the current step a process is in as it happens. i can accumulate them, as your model shows, and dump that out as a log, of sorts. But in order to monitor progress of one request's processing on the server, a series of follow-ups have to get feedback which the original is providing on the side (as T.J. recommended). Unless i'm missing something, which would be great if you could help me fill that in. :) -joe t. On Dec 11, 3:29 am, Alex McAuley webmas...@thecarmarketplace.com wrote: in your ajax request file ?php ini_set('output_buffering',0); // make sure the output_buffering directive is not set high ob_start(); // before anything is echoed to the screen for($i=0;$i10;$i++) { echo('liPrinting Line '.$i.'/li'); ob_flush(); flush(); sleep(1); // sleep for one second } ? this will output a line every second for 10 seconds Hope this helps P.S if you use ob_gz_handler this may not work (untested using it) Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: joe t. thooke...@gmail.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Friday, December 11, 2009 1:00 AM Subject: [Proto-Scripty] Re: Progressive update messages from single request david: The buffer/flush path seems to be where this solution is heading. Don't ask me why, but iframes rub me the wrong way. With the evolving needs for more streamlined connections, iframes feel like soggy bandaids to me. Given they have a place where nothing else seems to work (Ajax-ish file uploads), but i'd prefer to steer away from them in this case if i can. TJ: That seems like a fairly solid idea. Same general concept of having a second request object checking in on progress that the server reports back, it just gets it from a relatively more reliable source (instead of $_SESSION). Alex: Could you elaborate a bit, or point me to where i can follow up on that? i'm intrigued, but i'm not deeply familiar with using the output buffer effectively. Thanks for the replies! -joe t. On Dec 10, 3:45 am, Alex McAuley webmas...@thecarmarketplace.com wrote: I noticed you were using PHP on the server side ... you can also use output buffering to achieve this in one request Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: T.J. Crowder t...@crowdersoftware.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Thursday, December 10, 2009 8:38 AM Subject: [Proto-Scripty] Re: Progressive update messages from single request Hi Joe, It seems to me the simple way to do this is have the first request initiate a process on the server that keeps running when the request completes; the request returns an indicator of the current status and an identifier for the action. Your subsequent requests supply the identifer, which allows the server- side page to check the progress of the ongoing work matching that ID and report back the (new) status. People use things like this for showing progress bars for file uploads without using Flash, that kind of thing. HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote: i think i've seen examples of this, but can't recall where, and could use some guidance. Obviously it's easy to handle a 1:1 Request/Response How can i do a true 1:many process? For instance: Client takes a single action which requires the server to perform 3 tasks: * Query database * Generate PDF * Generate email, attach PDF, and send How can i respond to the client as EACH task is accomplished without ending the request chain? Looking up your data . . . (time-based dots as delay indicator) Creating PDF . . . Email sent (or failed, as the case may be) Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can point me in the right direction (which include samples), i'd be grateful. Thanks. -joe t. -- 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-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/prototype
[Proto-Scripty] Re: Progressive update messages from single request
david: The buffer/flush path seems to be where this solution is heading. Don't ask me why, but iframes rub me the wrong way. With the evolving needs for more streamlined connections, iframes feel like soggy bandaids to me. Given they have a place where nothing else seems to work (Ajax-ish file uploads), but i'd prefer to steer away from them in this case if i can. TJ: That seems like a fairly solid idea. Same general concept of having a second request object checking in on progress that the server reports back, it just gets it from a relatively more reliable source (instead of $_SESSION). Alex: Could you elaborate a bit, or point me to where i can follow up on that? i'm intrigued, but i'm not deeply familiar with using the output buffer effectively. Thanks for the replies! -joe t. On Dec 10, 3:45 am, Alex McAuley webmas...@thecarmarketplace.com wrote: I noticed you were using PHP on the server side ... you can also use output buffering to achieve this in one request Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: T.J. Crowder t...@crowdersoftware.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Thursday, December 10, 2009 8:38 AM Subject: [Proto-Scripty] Re: Progressive update messages from single request Hi Joe, It seems to me the simple way to do this is have the first request initiate a process on the server that keeps running when the request completes; the request returns an indicator of the current status and an identifier for the action. Your subsequent requests supply the identifer, which allows the server- side page to check the progress of the ongoing work matching that ID and report back the (new) status. People use things like this for showing progress bars for file uploads without using Flash, that kind of thing. HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote: i think i've seen examples of this, but can't recall where, and could use some guidance. Obviously it's easy to handle a 1:1 Request/Response How can i do a true 1:many process? For instance: Client takes a single action which requires the server to perform 3 tasks: * Query database * Generate PDF * Generate email, attach PDF, and send How can i respond to the client as EACH task is accomplished without ending the request chain? Looking up your data . . . (time-based dots as delay indicator) Creating PDF . . . Email sent (or failed, as the case may be) Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can point me in the right direction (which include samples), i'd be grateful. Thanks. -joe t. -- 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-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/prototype-scriptaculous?hl=en. -- 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-scriptacul...@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] Progressive update messages from single request
i think i've seen examples of this, but can't recall where, and could use some guidance. Obviously it's easy to handle a 1:1 Request/Response How can i do a true 1:many process? For instance: Client takes a single action which requires the server to perform 3 tasks: * Query database * Generate PDF * Generate email, attach PDF, and send How can i respond to the client as EACH task is accomplished without ending the request chain? Looking up your data . . . (time-based dots as delay indicator) Creating PDF . . . Email sent (or failed, as the case may be) Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can point me in the right direction (which include samples), i'd be grateful. Thanks. -joe t. -- 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-scriptacul...@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: Progressive update messages from single request
Thanks for the response Walter. i can see where you're going with that, but in those successively created new Ajax.Request calls, it's generating a new request to the server, which runs the server-side routine from the beginning, right? In my concept, the first call commands the server to run all three steps: Client Request 1 -- Collect the data (send feedback to client) -- Create the PDF (send feedback to client) -- Attach to an email and send (send final feedback) End Where your structure more resembles: Client Request 1 -- Collect data (send Feedback 1) -- Client Request 2 -- Create PDF (send Feedback 2) -- Client Request 3 -- Attach and email (send Feedback 3) End Am i correct? If so, that works only to the amount of detail i provide nested invocations of Ajax.Request to check/perform one specific detail of progress. Keep in mind this is only an example: what if i need feedback during the attachment process (attaching 1 of 100 files)? For one, it would be nasty to nest that many Ajax.Request calls, and more importantly, that email object only exists within the request that creates and processes it. The second request to attach file 2 of 100 isn't working on the same email object (as i understand it). i did find one QA similar to this where it was suggested to use $_SESSION for the current progress message... The initial Request gets the server going on the task, and also creates a second Request that repeats (eg, Ajax.PeriodicalUpdater). That one does nothing more than check $_SESSION for the latest message (which gets updated by the task being performed). That feels slightly better to me, despite the potential traffic overhead for longer requests (hence the {decay} option, i suppose). Something for me to chew on, i suppose. Thanks again, -joe t. On Dec 9, 1:22 pm, Walter Lee Davis wa...@wdstudio.com wrote: I would do this with chained onSuccess handlers. Each one would trigger a new request to a different endpoint, carrying some token to identify the visitor. $('button').observe('click',function(evt){ //do your lookup new Ajax.Request('lookup.php',{ parameters:{id:'?=$id?'}, onCreate:function(){ $('message').update('searching...');; }, onSuccess:function(transport){ //make your pdf $('message').update('making PDF...');; new Ajax.Request('pdf.php',{ parameters:{id:'?=$id?'}, onCreate:..., //you get the idea onSuccess:... }); } }}; }); Walter On Dec 9, 2009, at 11:11 AM, joe t. wrote: i think i've seen examples of this, but can't recall where, and could use some guidance. Obviously it's easy to handle a 1:1 Request/Response How can i do a true 1:many process? For instance: Client takes a single action which requires the server to perform 3 tasks: * Query database * Generate PDF * Generate email, attach PDF, and send How can i respond to the client as EACH task is accomplished without ending the request chain? Looking up your data . . . (time-based dots as delay indicator) Creating PDF . . . Email sent (or failed, as the case may be) Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can point me in the right direction (which include samples), i'd be grateful. Thanks. -joe t. -- 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 athttp://groups.google.com/group/prototype-scriptaculous?hl=en . -- 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-scriptacul...@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] InPlace[Collection]Editor deprecation layer
i came across this block of text in Scriptaculous controls.js 1.8.2 . 3: // DEPRECATION LAYER FOR InPlace[Collection]Editor! // This only exists for a while, in order to let // users adapt to the new API. Read up on the new // API and convert your code to it ASAP! As i use both of those Classes, i want to make sure i'm using the newer API, but there's no indication where i can read up on the new API, and the documentation on script.aculo.us is fairly vague about what's new and deprecated. Anyone have some kind of timeline for this deprecation? Where can i read up to make sure i'm current? Thanks. joe t. -- 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-scriptacul...@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
Which methods you propose for the library are entirely up to you. The development team will make the ultimate decision if they want to include them or make efficiency modifications. i was just offering a tweak to #compact to make it work as described. :) Good luck! -joe t. On Nov 13, 12:19 pm, jacoz jacopo.nu...@gmail.com wrote: Hi Joe T., well, I've followed your suggests and so (I remember you the linkhttp://tr.im/EBEP): - updated Array#compact - updated Element#ajaxRequest - added Element#ajaxUpdate So now you have an empty function when using #ajaxRequest, and the update function when using #ajaxUpdate! Is that good, according to you? Which methods would you suggest me to propose? Thank you so much! Jacopo. On Nov 13, 4:49 pm, joe t. thooke...@gmail.com wrote: i agree with a lot of Eric's points so far. There are some interesting, and possibly useful utility methods in this, but there are others that would needlessly bloat an already fairly bloated library (don't get me wrong, i still love it). The thing i would point out for #ajaxRequest is similar to Eric's point: by embedding an onSuccess call, you force the user to either replace it with their own callback, or pass an empty function just to make it not do the default element update. It's usually better practice to minimize the amount of required options and let the user include more as they need them. i actually don't do element updates from Ajax request as a frequent practice, so this modification would harm my code overhead. Also, as a minor clarification: in #compact, the strict argument name should be changed to aggressive. ( ) is not strictly an empty string. It's just 100% white space. Seems like nitpicking, but with other mentions of helping novice coders understand more about JS libraries, consistent semantics are a huge part of that. Eric's right about using tests outside loops, but there are a couple issue with the proposed correction: 1. From the original, value.strip() is wrong, because #strip() doesn't exist for non-string values. 2. Several values are false-ish, so they get removed from the results even without the aggressive argument. If the intent of this #compact method is to only remove null/undefined in lazy mode, Prototype.K won't work. Returning to the select() comparison ends up false, so gets dropped. Suggested: compact(aggressive){ return this.select(aggressive === true ? function(v){return v != null v.toString().strip() != ''} : function(v){return v !== null v !== undefined} ) } The adjustment ensures that the intent of only stripping null and undefined remains intact, since so many values can evaluate to false- ish (, 0, [], etc). And mentioning zero, what if there's desire to be super-aggressive and remove those, or also remove actual boolean falses? :) -joe t. On Nov 13, 8:07 am, Eric lefauv...@gmail.com wrote: Hi Jacopo, On Nov 12, 4:29 pm, jacoz jacopo.nu...@gmail.com wrote: Hi Eric, thanks for your suggests! Well, now I answer all of your questions ;) - I named Element.ajaxRequest() in that way because by default it updates the element, but you can change the onSuccess function! OK, but if you don't change the element in the onSuccess, there is no point using this method instead of Ajax.Request. - I've written String#len and String#getType because some newbies may not knows that attributes ;) Well, you must not forget that every single byte you add to the library will be loaded by every single page using the library. Peoples are already complaining because prototype is big, so if we start to add useless things, it will be worst. Moreover, newbies should better learn about length and the DOM attributes instead of some exotic name not portable (and slower) methods - I've re-written Array#compact: now the control is not recursive It wasn't recursive, it was slow :o) But still, return value != null is the same than return value (at least when passed to Enumerable.select) and it is exactly what Prototype.K function does. (thanks) Here is the code:http://tr.im/EBEPtheArray#comapctstartsat at line 128 Which methods do you suggest me to propose?? Well it is up to you, but Element.ajaxUpdate, Object.isBoolean or your change to Array.compact sounds like useful features to me. Eric Thanks, Jacopo. On Nov 12, 11:15 am, Eric lefauv...@gmail.com wrote: 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
[Proto-Scripty] Re: Prototype.jExtension
i agree with a lot of Eric's points so far. There are some interesting, and possibly useful utility methods in this, but there are others that would needlessly bloat an already fairly bloated library (don't get me wrong, i still love it). The thing i would point out for #ajaxRequest is similar to Eric's point: by embedding an onSuccess call, you force the user to either replace it with their own callback, or pass an empty function just to make it not do the default element update. It's usually better practice to minimize the amount of required options and let the user include more as they need them. i actually don't do element updates from Ajax request as a frequent practice, so this modification would harm my code overhead. Also, as a minor clarification: in #compact, the strict argument name should be changed to aggressive. () is not strictly an empty string. It's just 100% white space. Seems like nitpicking, but with other mentions of helping novice coders understand more about JS libraries, consistent semantics are a huge part of that. Eric's right about using tests outside loops, but there are a couple issue with the proposed correction: 1. From the original, value.strip() is wrong, because #strip() doesn't exist for non-string values. 2. Several values are false-ish, so they get removed from the results even without the aggressive argument. If the intent of this #compact method is to only remove null/undefined in lazy mode, Prototype.K won't work. Returning to the select() comparison ends up false, so gets dropped. Suggested: compact(aggressive){ return this.select(aggressive === true ? function(v){return v != null v.toString().strip() != ''} : function(v){return v !== null v !== undefined} ) } The adjustment ensures that the intent of only stripping null and undefined remains intact, since so many values can evaluate to false- ish (, 0, [], etc). And mentioning zero, what if there's desire to be super-aggressive and remove those, or also remove actual boolean falses? :) -joe t. On Nov 13, 8:07 am, Eric lefauv...@gmail.com wrote: Hi Jacopo, On Nov 12, 4:29 pm, jacoz jacopo.nu...@gmail.com wrote: Hi Eric, thanks for your suggests! Well, now I answer all of your questions ;) - I named Element.ajaxRequest() in that way because by default it updates the element, but you can change the onSuccess function! OK, but if you don't change the element in the onSuccess, there is no point using this method instead of Ajax.Request. - I've written String#len and String#getType because some newbies may not knows that attributes ;) Well, you must not forget that every single byte you add to the library will be loaded by every single page using the library. Peoples are already complaining because prototype is big, so if we start to add useless things, it will be worst. Moreover, newbies should better learn about length and the DOM attributes instead of some exotic name not portable (and slower) methods - I've re-written Array#compact: now the control is not recursive It wasn't recursive, it was slow :o) But still, return value != null is the same than return value (at least when passed to Enumerable.select) and it is exactly what Prototype.K function does. (thanks) Here is the code:http://tr.im/EBEPtheArray#comapct starts at at line 128 Which methods do you suggest me to propose?? Well it is up to you, but Element.ajaxUpdate, Object.isBoolean or your change to Array.compact sounds like useful features to me. Eric Thanks, Jacopo. On Nov 12, 11:15 am, Eric lefauv...@gmail.com wrote: 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
[Proto-Scripty] Re: Does $A('.classname').invoke('setValue',...) work on checkboxes?
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. i suppose in the meantime there's Element.writeAttribute ({value:foo}); However, i raise caution on that because i've had inconsistent results in the past where the DOM recognizes the attribute as changed, but the browser did not update the visual display of the value (text inputs at the time), and submitted the original value. It was as though the input tag's value attribute and the control's value property were different entities. The only way i found to address it was $ ('element').value = foo; which obviously kills the elegance of chaining methods, but seems to address both entities, and is how Form.Element.Serializers returns other values. -joe t. On Nov 10, 12:30 pm, Szymon Wilkołazki wilkola...@gmail.com wrote: Hi, I found where is the problem. I assumed, that the Form.Element.setValue method sets the value of an element. In case of checkboxes that is not true. The method changes the state of checked/unchecked instead, and leaves the value attribute unchanged. The example might be found here: http://tsalarioth.art.pl/~sw/setValueTest.html As you can see, if you click on the button set value of checkbox to: with empty input, the checkbox is unchecked. If the value is not empty, then checkbox will be checked. I do not understand why this behaviour was chosen, but I understand that it can't be changed now, as it would break backward compatibility. Anyway I think the setValue method needs better documentation, as it is now a little bit misleading. I will open a lighthouse DOC ticket for this. 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: Prototype Unit Testing Framworks
We use JsUnit with prototype successfully. Could you post any additional info about the errors you are getting? What version of prototype/jsunit/browser are you using? I will say that JsUnit seems to be basically on life support so you might want to look in to something else. I've recently been looking in to the YUI Test library which seems very full featured. http://developer.yahoo.com/yui/3/test/ Joe On Nov 10, 1:51 pm, Daff d...@spidertracks.co.nz wrote: Hi All, I have been trying to find a Javascript Unit testing framework that works with Prototype. I initially tried JsUnit, but it would appear that there is a namespace conflict with the asserts, because as soon as I include the prototype file, all the previously passing test fail, with errors. I have searched the forums and did note that there is mention of unittest.js in some of them but have been unable to find said file. The posts where is was mentioned were also quite old. I am really more interested in what others are using to test their Prototype created classes via unit testing. Any thoughts of help would be most appreciated. -- daff SOFTWARE ENGINEER andrew 'daff' niles | spider tracks ltd | 117a the square po box 5203 | palmerston north 4441 | new zealand P: +64 6 353 3395 | M: +64 210 255 8576 E: d...@spidertracks.co.nz mailto:d...@spidertracks.co.nz W:www.spidertracks.comhttp://www.spidertracks.com --~--~-~--~~~---~--~~ 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: New API Doc
TJ- First, it's great to see there's diligent activity on the docs, which seemed like they went stale for a while there. To the whole team, keep up the great work! Definitely need the quick-look menu of methods (and any other properties) provided by each of the major classes. i have a suggestion for enhancement, and two issues with the new docs: Enhancement: It might be helpful to somehow indicate from the (to-be-improved) navigation when a method HAS, or IS, an alias. Why do i want to see the actual documentation on Enumerable#select or Enumerable#filter when all it's going to tell me is Alias of Enumerable#findAll? Especially when they don't operate any differently. Show me that in the menu so i can just go to #findAll directly. Or better yet, don't give aliases a method-level entry at all. Perhaps something like the following: * Enumerable - link to main Enumerable doc - findAll - link to #findAll, where the aliases are also noted (filter) - link to #filter, if the user REALLY wants to see it (select) - link to #select, if the user REALLY wants to see it Issues: 1. This seems isolated to Firefox/Gecko. The menu panel doesn't scroll normally. i have no idea why, but it scrolls about 1/10th the expected speed, which is a nuisance. 2. This one is happening in all browsers. If i click Element (for instance), location bar says http://api.prototypejs.org/dom/element.html If i then click #select, i'm taken to that method: http://api.prototypejs.org/dom/element.html#select-class_method Great. But the natural impulse (mine, at least) to get back to that list of methods is to use the browser's Back action. Gotcha! The location bar returns back, but the browser window doesn't. Thanks! -joe t. On Oct 27, 7:29 pm, Adm.Wiggin admwig...@gmail.com wrote: How's this going? Very much interested in Going back to page-per- method (rather than a long run-on page). Having the side navigation easy to navigate in the page-per-method style like the old documentation is also of paramount importance. For example, if I click on Hash in the sidebar, I should immediately see an easy to read list of all the methods of the Hash class. As it is, they're in a big block, which is hard to scan through, where the vertical (alphabetical) list was quick and relatively painless. Lots of times, I'm just looking to verify the order of parameters, and it was very helpful to be able to find the exact method very quickly so that in almost no time I'm looking at the page reading the order of the methods. Something else that might be handy way further down the road is an easy way to access these pages by-url. For example, if I need to look up a PHP function to very the argument order, it's as easy as typing inhttp://php.net/function_name_here-- concrete example being stripos (is it haystack first, or needle first? I never can remember)http://php.net/striposand I'm there immediately. Obviously way down the road, but certainly something to think about. On Oct 9, 3:56 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi, You're not the only one, not by a long chalk. :-) We're working on it. Tobie, Samuel, and Andrew are working hard to improve the structure, navigation, and presentation, and I'm continuing the ongoing quest of copying over, updating, and fleshing- out the content (which is a manual and labor-intensive process). You should see marked improvemenet in the online docs over the course of the next couple of weeks. What happened is that the project switched from having the documentation be a completely separate thing (in a difficult-to-use tool) to having the documentation be part of the source code (a'la Javadoc), using a new tool built for the purpose called PDoc. That way, when someone changes or adds code, they can update the documentation at the same time, and hopefully the two will be kept much more in sync. (The official policy, in fact, is that code patches with documentation impacts that don't include the documentation updates are rejected.) It also simplifies the process of people reporting and offering patches for documentation errors/ omissions. However, the docs got inadequate testing (and weren't complete) when 1.6.1 was released. 1.6.1 *needed* to be released, there was a lot of good, urgently-needed stuff in there (generally, and for IE8 and Chrome). If you want to, you can still get to the old docs (for now) here:http://prototypejs.org/api However, I expect to finish copying/updating/improving the content Real Soon Now (happen to be working on that today), which will at least address the content issue. And Tobie and Samuel just had a week- long codefest on the tool so we should see those improvements very soon. One thing that would be *really* useful would be to know what it is you find difficult about navigation (and just generally what's difficult about using the docs), so that that feedback
[Proto-Scripty] Re: Private methods for prototype class
i tried Allen's sample in Firebug, and someVar is accessible from outside. aWorker.someVar = outside value; console.info(aWorker.someVar); // outside value Also works when a new instance of the class is assigned: var x = new aWorker(); x.someVar = outside value; console.info(x.someVar); // outside value -joe t. On Sep 10, 2:45 pm, Ngan nganp...@gmail.com wrote: Hi Allen, thank you so much for the reply. If I do it that way, someVar will now be a private variable. What if I wanted someVar to be an instance variable. so that it may be accessed externally: aWorker.someVar hence why I did: this.someVar = 'var'; Is this something that you have to give up when going with this pattern? On Sep 10, 11:07 am, Allen bla...@gmail.com wrote: Hi Ngan, This should do what you want. var Worker = Class.create((function() { var someVar; function initialize() { someVar = var; privateMethod(); } function publicMethod() { privateMethod(); } function privateMethod() { console.info(someVar); console.info(this) } return { initialize: initialize, publicMethod: publicMethod }; })()); On Sep 10, 1:10 pm, Ngan nganp...@gmail.com wrote: Hi, I apologize if this question has been asked before. I've tried googling for this, but did find a good answer. What's the best way to have private methods using prototype's Class.create? I've tried... var Worker = Class.create((function() { function initialize() { this.someVar = var; privateMethod(); } function publicMethod() { privateMethod(); } function privateMethod() { console.info(this.someVar); console.info(this) } return { initialize: initialize, publicMethod: publicMethod }; })()); Running this will give me: aWorker = new Worker(); # console.info(this.someVar) #= undefined # console.info(this.someVar) #= DOMWindow However: aWorker.publicMethod() #= WORKS! Thank you for your time! --~--~-~--~~~---~--~~ 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] IE8 not extending Elements?
During my dom:loaded event, all browsers except IE8 are working correctly. http://pastie.org/613517 http://comet.sawyernursery.com Error 1 (line 4): IE Debugger says $('splash') is valid DispHTMLDivElement, but $('splash').select is undefined. Error 2 (line 30): $('GoToPageTop') is DispHTMLAnchorElement, but $ ('GoToPageTop').observe is undefined Error 3 (line 35): $('loadingBox') is DispHTMLDivElement, but $ ('loadingBox').centerX is undefined. Error 4 (line 15): If i step over the other errors with IE's debugger, the execution will reach this line, but when it executes, an error is returned from prototype.js Line 399 (in the Pastie, line 7 from Prototype). Notes: * Keep in mind, it's working correctly in FF, Opera, Safari, Chrome. * All errors are Object doesn't support property or method. * centerX is an Element method i use * $ is apparently returning elements, but it's like they're failing to extend, with no error about the fail. * i just tried to show an element from the IE Debugger console after page load and get the same error: $('loadingBox').show(); // Error. Same as above. Let me know what else will help find an answer. -joe t. --~--~-~--~~~---~--~~ 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] Stack overflow in IE when using both Ext JS and Prototype 1.6.1
This is more of an FYI in case anyone is using Ext and Prototype on a project. I can't exactly figure out why, but something change in the way prototype is defining or using it's defer function from 1.6.0.3 to 1.6.1 which causes a stack overflow to occur in IE6 (and maybe IE7). Ext and Prototype both define a defer function on the Function prototype but with incompatible usage. See this post in the Ext forums for more information http://www.extjs.com/forum/showthread.php?t=78935. I posted a patch in that thread which changes the name of the prototype defer function to work around the problem. I guess I can't really say this is a bug, but it would be interesting to know why it is a problem now in 1.6.1. Doesn't seem like the code in prototype changed much. -Joe --~--~-~--~~~---~--~~ 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: InPlaceCollectionEditor : loadCollectionURL data format
That's actually not progress. The IPCE requires arrays, not JSON Objects. You're seeing [object Object] because the outermost array contains a series of objects. Your original PHP echo was correct, so the place to look is in your Javascript that constructs the collection editor. Correct collection structure: ?php echo [['12.00', '12.00'], ['24.00', '24.00'], ['36.00','36.00']]; ? Each sub-array is used as the OPTION's value display. To distinguish things a little bit: ?php echo [['12.00', 'Twelve'], ['24.00', 'Twenty-four'], ['36.00','Thirty-six']]; ? You would end up with: select ... option value=12.00Twelve/option option value=24.00Twenty-four/option option value=36.00Thirty-six/option /select Let's see what your collection constructor looks like. -joe t. On Sep 6, 11:50 am, mlh m...@free.fr wrote: Hey, After a new attempt, whereI changed my PHP called page to : ?php echo '[{key:Al, value:Alan}, {key:Bi, value:Bill}, {key:Ca, value:Carl}, {key:Da, value:Dave}, {key:Er, value:Erik}, {key:Fr, value:Fran}, {key:Ge, value:Gene}]'; ? I don't get the message Loading options in my select box anymore, but a list where all elements are called [object Object] ... All option items look like this : option value=[object Object][object Object]/option I progress, but I'm still expecting a bit of help. Thanks a lot. Regards. Michel L'HUILLIER mlh a écrit : Hey, I have a small problem with Scriptaculous and InPlaceCollectionEditor : I can use inline collections like this : var collection_1 = [['twelve', '12.00'], ['twenty-four.00', '24.00'], ['thirty-six.00', '36.00']]; var collection_2 = ['Alan', 'Bill', 'Carl', 'Dave', 'Erik', 'Fran', 'Gene']; Both work well ! But, when I want to use a distant collection, with the loadCollectionURL, the doc is not as helpful as I wish... It's only told that the answer has to be JSON... I precise that my URL is OK. I tried many things like this in the called page : ?php echo var collection = ['bh', 'col', 'corb', 'dukes', 'house', 'iow', 'ps']; ? or this : ?php echo [['12.00', '12.00'], ['24.00', '24.00'], ['36.00', '36.00']]; ?... but the only answer on my main page is : Loading options in the option box... I use PHP, and just need to have an example of the syntax and the format to use. Did one of you encountered and solved this problem ? Thanks for any help. Michel L'HUILLIER --~--~-~--~~~---~--~~ 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: Form.request() file upload problem in ie6
The file form control itself is a pain to style and is kind of an eyesore. But it can be hidden and other controls used (say, a styled button or link that activates the click action of the file control) to obtain the file path value that the form control will upload. Flash isn't the only way to Ajax a file, but it's probably the easiest. IFRAME is another option which doesn't require the Flash plugin, but does usually requires more hand coding. A quick Google search(http://www.google.com/search?q=ajax+file+upload) brought up this: http://www.webtoolkit.info/ajax-file-upload.html among others. Essentially, after the IFRAME form submits, the reloaded page of the frame disaplays info about the upload (GMail-esque). -joe t. On Jul 5, 8:26 am, Vladimir Tkach tea...@gmail.com wrote: Browsers force us to use file inputs for uploads, which are impossible to style. Moreover, form-based uploads look obsolete in modern ajax applications. We can use flash to solve this problem, but javascript works nice too. http://teamco-anthill.blogspot.com/2009/01/ajax-file-upload.html 2009/7/5 webbear1000 normpo...@hotmail.com You could try YUI uploader if you're prepared to use Flash http://developer.yahoo.com/yui/uploader/ -- Best Regards, Vladimir Tkach +972-54-7574166 tea...@gmail.com http://teamco-anthill.blogspot.com/ --~--~-~--~~~---~--~~ 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: Periodical Updater detect content change
Hope this helps. Ajax/Prototype/JSON PeriodicalUpdater: A working example – log update on a background process http://joekuan.wordpress.com/2009/06/22/ajaxprototypejson-periodicalupdater-a-working-example-log-update-on-a-background-process-part-12/ On Jun 23, 3:20 pm, Aamchi aman.ra...@googlemail.com wrote: Hi, I was wondering if Ajax.PeriodicalUpdater can detect if content has changed since the last update and if so trigger an event. So for example I have a scoreboard which fetches data every 5 seconds and displays this. I would be cool if there could be some kind of notification if content had changed. I know that the new content is stores in responseText but how can I compare it to the previous content... Thanks, Aman --~--~-~--~~~---~--~~ 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: Adding properties to native objects
T.J., i think my last post was at least somewhat in line with your suggestion. i just hadn't fully read and absorbed yours yet. i will try using that factory approach. If i'm reading it right, it handles the two-line requirement of creating the native Date, then calling the ApplySpecialProps method. As always, thanks for the help! -joe On May 20, 12:23 pm, T.J. Crowder t...@crowdersoftware.com wrote: Heya, You may want to use Crockford's factory pattern, rather than using any sort of constructor: function specialDateFactory() { var that = new Date(); that.isEaster = function () {return ...}, that.isLaborDay = function () {return ...}, return that; } The problem with that as written is that it creates separate isEaster and isLaborDay functions for every single instance you create, each of which eats memory: var a = specialDateFactory(); var b = specialDateFactory(); alert(a.isEaster === b.isEaster); // false You can avoid that: var MoreDateFunctions = { isEaster: function () {return ...}, isLaborDay: function () {return ...}}; function specialDateFactory() { return Object.extend(new Date(), MoreDateFunctions); // Or, without Prototype's Object.extend: // var fname, that; // that = new Date(); // for (fname in MoreDateFunctions) { // that[fname] = MoreDateFunctions[fname]; // } // return that; } ...but I'm not seeing much benefit at that point. I suppose it means you haven't modified the Date prototype. (BTW: Anyone tempted to create an ExtendedDate object using a Date object as its prototype, think again, for some reason the spec specifically disallows it in Section 15.9.5, and Firefox [and probably others] implements the limitation.) -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On May 20, 4:07 pm, P. Douglas Reeder reeder...@gmail.com wrote: You may want to use Crockford's factory pattern, rather than using any sort of constructor: function specialDateFactory() { var that = new Date(); that.isEaster = function () {return ...}, that.isLaborDay = function () {return ...}, return that; } You can get more sophisticated - creating a prototype object for special dates, with the functions defined on it, and using closures to protect it, but I can't write that off the top of my head... On May 20, 7:50 am, ColinFine colin.f...@pace.com wrote: On May 20, 12:16 am, RobG rg...@iinet.net.au wrote: On May 19, 9:26 pm, ColinFine colin.f...@pace.com wrote: This is a case when you really truly want just the facilities that Javascript provides (prototypes rather than classes), and using (pretend) classes makes it harder not easier. Yes, although some may argue that it is better to create a new object that has the required methods and leverages the methods of Date, rather than modifying a built-in object prototype, Fair comment. But you are still talking about using Javascript's prototype, rather than inventing classes. That was my point. (I wouldn't have made this remark before I read Crockford's Javascript: The Good Parts - that's opened my eyes to the strengths that JS has. ) Colin --~--~-~--~~~---~--~~ 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: Adding properties to native objects
Thanks to all for your feedback. i think though, that some of the focus has remained on adding new *methods* to the Date object. That's easy enough, as in my first sample. However, i'm trying to add properties to the object that obtain a value when a new Date is constructed. var myDate = new Date(); alert(myDate.isEaster); // Alerts 'true' or 'false' alert(myDate.isLaborDay); // Alerts 'true' or 'false' etc. i realize that these property values would still need to be obtained from return values of functions. That's why my second sample includes the _isEaster methods, but also has this.isEaster receiving the return value of the _isEaster method. Consider: if (myDate.isEaster){alert('Happy Easter'); vs if (myDate.isEaster()){alert('Happy Easter'); Any time i want to utilize, compare, etc. that the date is or is not Easter, i can either have a quick-access boolean property, or a lengthy calculation from a method. Obviously these are simplified examples, but when applied to the bigger concept of reserved dates, and that these reservations could overlap (isEaster isMyBirthday, for instance), property testing could reduce some decent calculation overhead. However, if it can't be done, it can't be done. i suppose i can simply add a second line after constructing a new Date: Date.prototype.ApplySpecialDateProps = function(){ this.isEaster = (function(d){ // Calculate something from d return ... })(this), this.isLaborDay = (function(d){ // Calculate something from d return ... })(this), ... } var myDate = new Date(); myDate.ApplySpecialDateProps(); i was just hoping to get the special properties to be part of the Date object's construction. -joe On May 20, 12:23 pm, T.J. Crowder t...@crowdersoftware.com wrote: Heya, You may want to use Crockford's factory pattern, rather than using any sort of constructor: function specialDateFactory() { var that = new Date(); that.isEaster = function () {return ...}, that.isLaborDay = function () {return ...}, return that; } The problem with that as written is that it creates separate isEaster and isLaborDay functions for every single instance you create, each of which eats memory: var a = specialDateFactory(); var b = specialDateFactory(); alert(a.isEaster === b.isEaster); // false You can avoid that: var MoreDateFunctions = { isEaster: function () {return ...}, isLaborDay: function () {return ...}}; function specialDateFactory() { return Object.extend(new Date(), MoreDateFunctions); // Or, without Prototype's Object.extend: // var fname, that; // that = new Date(); // for (fname in MoreDateFunctions) { // that[fname] = MoreDateFunctions[fname]; // } // return that; } ...but I'm not seeing much benefit at that point. I suppose it means you haven't modified the Date prototype. (BTW: Anyone tempted to create an ExtendedDate object using a Date object as its prototype, think again, for some reason the spec specifically disallows it in Section 15.9.5, and Firefox [and probably others] implements the limitation.) -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On May 20, 4:07 pm, P. Douglas Reeder reeder...@gmail.com wrote: You may want to use Crockford's factory pattern, rather than using any sort of constructor: function specialDateFactory() { var that = new Date(); that.isEaster = function () {return ...}, that.isLaborDay = function () {return ...}, return that; } You can get more sophisticated - creating a prototype object for special dates, with the functions defined on it, and using closures to protect it, but I can't write that off the top of my head... On May 20, 7:50 am, ColinFine colin.f...@pace.com wrote: On May 20, 12:16 am, RobG rg...@iinet.net.au wrote: On May 19, 9:26 pm, ColinFine colin.f...@pace.com wrote: This is a case when you really truly want just the facilities that Javascript provides (prototypes rather than classes), and using (pretend) classes makes it harder not easier. Yes, although some may argue that it is better to create a new object that has the required methods and leverages the methods of Date, rather than modifying a built-in object prototype, Fair comment. But you are still talking about using Javascript's prototype, rather than inventing classes. That was my point. (I wouldn't have made this remark before I read Crockford's Javascript: The Good Parts - that's opened my eyes to the strengths that JS has. ) Colin --~--~-~--~~~---~--~~ 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
[Proto-Scripty] Re: Adding properties to native objects
One last note barring any huge revelations: T.J.'s factory suggestion was almost exactly right. His code as-is adds the methods to my customized Date. However, since i want properties of the same name that receive the return values of those methods, i MUST use the non-Object#extend version, as such: var SpecialDateProps = { isEaster:function(){ return ... }, etc. }; function DateFactory(){ var fName, that = new Date(); for (fName in SpecialDateProps) that[fName] = SpecialDateProps[fName](); // Note calling the fName's function. return that; } Thanks again! -joe t. On May 20, 1:12 pm, joe t. thooke...@gmail.com wrote: T.J., i think my last post was at least somewhat in line with your suggestion. i just hadn't fully read and absorbed yours yet. i will try using that factory approach. If i'm reading it right, it handles the two-line requirement of creating the native Date, then calling the ApplySpecialProps method. As always, thanks for the help! -joe On May 20, 12:23 pm, T.J. Crowder t...@crowdersoftware.com wrote: Heya, You may want to use Crockford's factory pattern, rather than using any sort of constructor: function specialDateFactory() { var that = new Date(); that.isEaster = function () {return ...}, that.isLaborDay = function () {return ...}, return that; } The problem with that as written is that it creates separate isEaster and isLaborDay functions for every single instance you create, each of which eats memory: var a = specialDateFactory(); var b = specialDateFactory(); alert(a.isEaster === b.isEaster); // false You can avoid that: var MoreDateFunctions = { isEaster: function () {return ...}, isLaborDay: function () {return ...}}; function specialDateFactory() { return Object.extend(new Date(), MoreDateFunctions); // Or, without Prototype's Object.extend: // var fname, that; // that = new Date(); // for (fname in MoreDateFunctions) { // that[fname] = MoreDateFunctions[fname]; // } // return that; } ...but I'm not seeing much benefit at that point. I suppose it means you haven't modified the Date prototype. (BTW: Anyone tempted to create an ExtendedDate object using a Date object as its prototype, think again, for some reason the spec specifically disallows it in Section 15.9.5, and Firefox [and probably others] implements the limitation.) -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On May 20, 4:07 pm, P. Douglas Reeder reeder...@gmail.com wrote: You may want to use Crockford's factory pattern, rather than using any sort of constructor: function specialDateFactory() { var that = new Date(); that.isEaster = function () {return ...}, that.isLaborDay = function () {return ...}, return that; } You can get more sophisticated - creating a prototype object for special dates, with the functions defined on it, and using closures to protect it, but I can't write that off the top of my head... On May 20, 7:50 am, ColinFine colin.f...@pace.com wrote: On May 20, 12:16 am, RobG rg...@iinet.net.au wrote: On May 19, 9:26 pm, ColinFine colin.f...@pace.com wrote: This is a case when you really truly want just the facilities that Javascript provides (prototypes rather than classes), and using (pretend) classes makes it harder not easier. Yes, although some may argue that it is better to create a new object that has the required methods and leverages the methods of Date, rather than modifying a built-in object prototype, Fair comment. But you are still talking about using Javascript's prototype, rather than inventing classes. That was my point. (I wouldn't have made this remark before I read Crockford's Javascript: The Good Parts - that's opened my eyes to the strengths that JS has. ) Colin --~--~-~--~~~---~--~~ 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] Adding properties to native objects
i haven't had much luck finding what i'm looking for, so maybe i'm not looking for it correctly. i want to add several properties (booleans indicating special dates) to the native Date object that are assigned when the date is instantiated. However, i'm not sure how i can do that. i know i can extend Date with methods that return a boolean: Object.extend(Date,{ isEaster:function(){return ...}, isLaborDay:function(){return ...}, etc. }); but as far as i know, they have to be called after the Date is created. i'm trying to simulate native properties, eg: Date = Class.create(Date, { initialize:function(){ $super(arguments[0], ...); this.isEaster = this._isEaster(); this.isLaborDay = this.isEaster ? false : this._isLaborDay(); // etc... }, _isEaster:function(){ return ... }, _isLaborDay:function(){ return ... } }); i'm AWARE the above Class call doesn't work. But something like that is what i'm trying to achieve. How can i modify the native object's constructor to do its normal call, and also assign these properties? Any help? -joe t. --~--~-~--~~~---~--~~ 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: Ajax.Autocompleter and running scripts in results
What you are looking for is the evalScripts option that you can pass to Ajax.Updater. See this page for more information about it: http://prototypejs.org/api/ajax/updater So you could do something like this: new Ajax.Updater('items', '/items', { parameters: { text: $F('text') }, evalScripts: true }); On Apr 8, 9:42 am, Antti Boman antti.bo...@gmail.com wrote: I actually checked the source and couldn't find anything there, or then I just didn't understand it completely. That's why I decided to ask here. The updateElement and afterUpdateElement methods are useless in this case, as they are run after the selection's been made. Also, callback is too early for my purposes. The thing I'm looking for is in the middle of them, and it seems there is no such thing and I may have to code it myself. Thanks for your help, anyway! -a On Apr 8, 5:06 pm, Walter Lee Davis wa...@wdstudio.com wrote: I haven't seen anything in the Wiki either, but you might want to check the source. There may be a function in there you could hook on to that's just not documented. The only two events in the autocompleter cycle that appear extensible are updateElement (where you have to replace the entire add-the-item-to-the-field part with your own creation), afterUpdateElement (which looks interesting) and callback (before the field data is sent to the server, might be too soon for you). Walter On Apr 8, 2009, at 8:50 AM, Antti Boman wrote: I couldn't find any method for the Autocompleter object that would run a piece of javascript, either. And I also didn't find anything by googling. --~--~-~--~~~---~--~~ 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: Is there a obfuscator that works particularly well with Script.aculo.us?
From my experience YUI compressor is both extremely good and very safe. I believe they have fixed any of these one off things like $super that could create bugs. We've been using it for well over a year and shrink prototype, scriptaculous, ExtJS, and our own code all together. Works great. Joe On Apr 7, 9:35 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi, The thing to be careful about with any of these is that if they change the names of argument to functions (like Dean Edwards' Packer[1] does), you need to modify them so that they leave the $super argument name alone, since it has special meaning[2] to Prototype. Perhaps slightly OT, but you'll find some notes on minimizing file download sizes (as opposed to obfuscation) and such here[3] on the unofficial wiki. [1]http://dean.edwards.name/weblog/2007/04/packer3/ [2]http://prototypejs.org/api/class/create [3]http://proto-scripty.wikidot.com/prototype:tip-minimizing-download-times HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Apr 6, 8:45 pm, Jay jebum@gmail.com wrote: Or feel free to share your experience with any particular obfuscator tool. Thanks. --~--~-~--~~~---~--~~ 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] BUG: IE Fails to Set the innerHTML Property of the Select Object
Hi, We are hitting the IE bug kb276228 9BUG: Internet Explorer Fails to Set the innerHTML Property of the Select Object) with use of prototype.js. We were originally using prototype v1.5.0_rc1 and I updated to 1.6.0.3 and tested but made no difference. Could anyone advise if I could find a version of prototype where I could find the fix for the bug. Thanks Joe --~--~-~--~~~---~--~~ 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: BUG: IE Fails to Set the innerHTML Property of the Select Object
You are correct David. This is definitely an IE bug and I would be looking to apply the workaround mentioned in that page. But here the problem occurs only when prototype is being called within the jsp page. I verified this by removing prototype from the jsp page which had the problem. This jsp page which has the problem does not uses any AJAX functionality and we could get away with removing prototype being called. But this makes us vulnerable to any subsequent development with both the functionality (a select option and AJAX) I am not an expert with Ruby, Could you tell me which part of Prototype.js code should I be hacking for finding the solution to the problem. Thanks in Advance. Jose On Mar 13, 10:45 am, david david.brill...@gmail.com wrote: Hi Joe, the problem is not the version of prototype, but an IE bug. If you want to change the innerHTML of a select tag, you must modify the way you do it for IE. The solution given by Microsoft is athttp://support.microsoft.com/kb/276228/ -- david On 12 mar, 15:25, Joe joes...@gmail.com wrote: Hi, We are hitting the IE bug kb276228 9BUG: Internet Explorer Fails to Set the innerHTML Property of the Select Object) with use of prototype.js. We were originally using prototype v1.5.0_rc1 and I updated to 1.6.0.3 and tested but made no difference. Could anyone advise if I could find a version of prototype where I could find the fix for the bug. Thanks Joe --~--~-~--~~~---~--~~ 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: Ajax.InPlaceCollectionEditor seems to be broken in 1.8.2
Sorry, it took me some time to get organized and find time to work on this problem. i have NO idea whether this will help your situation, but i DID discover what i think solves the non-displaying SELECT list problem in IE. Using the IE8 JS debugger, controls.js fails at line ~841: this._controls.editor.update(''); because at line ~766, the SELECT object is created by the native createElement method, but is not Prototype extended: var list = document.createElement('select'); list.name = this.options.paramName; list.size = 1; this._controls.editor = list; i changed the last line shown above to: this._controls.editor = $(list); and IE started displaying the list. i couldn't tell you why Firefox manages to get by that little slip. i did try out your test pages and saw some of the incorrect behaviors. Unfortunately, i can't really dig deep right now to help with that. i wish you luck, and i'll post the fix above at Scriptaculous to On Jan 29, 12:03 pm, Gunter Sammet gunter.sam...@gmail.com wrote: On Jan 29, 6:56 am, joe t. thooke...@gmail.com wrote: i'm using unmodified 1.8.2 and the IPCE works fine with Firefox 3. IE is a totally different story, and damn me for not testing, thinking existing functionality wouldn't get broken with upgrades... IE doesn't display the SELECT control at ALL. -joe t. Did you try my 2 examples on FF3? Doesn't work for me on my Vista machine: http://sammysolutions.com/debugging/ajax/scriptaculous/sheeteditor-te...http://sammysolutions.com/debugging/ajax/scriptaculous/sheeteditor-te... Only have issues with the version where the value is not the same as the Option itself: select name=mySelect1 option value=123Volvo/option option value=345Saab/option option value=456Mercedes/option option value=678Audi/option /select Thanks for the input and if you manage to fix the IE issue, I'd appreciate if you can post it here. Cheers, Gunter --~--~-~--~~~---~--~~ 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: Form.request() ... Which submit button did the user press?
On the presumption that you're submitting from a button's click observer, you can use Event#element() to determine which element was clicked. Also, rather than using input type=submit .../ i typically use input type=button .../ to prevent the form from trying to unload the page as a form submission. -joe t. On Jan 25, 5:32 pm, Matt mattal...@gmail.com wrote: Is there any way of knowing which submit button was pressed from the post passed by Form.request()? I'm just getting the first submit button in the form, no matter which one I press. --~--~-~--~~~---~--~~ 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: jQuery or Prototype ?
On Jan 20, 8:51 am, SWilk wilkola...@gmail.com wrote: ... Enumerable mixin. I can't find anything like it in jQuery, and I use it very often in our applications (not a public website, but an intranet CRM and similar aplications). If you write classes representing your data, than it's very very useful. Not to mention what help it is with an array. What notable extra functionality offers jQuery over Prototype then? I know little of jQuery, but would like to know what we can/should improve ;) -- Regards, SWilk Seconded here. i actually switched BACK from jQuery because i didn't see anything that had broad coverage of enumerables. When i create a JS class that my web app will use, there are often data collections utilized within that class, and jQuery just doesn't seem to address those. It's focused heavily on DOM collections using CSS selectors, with little help for data. At least that's been my experience with it. i tend to like the jQuery filtering/unfiltering approach, though. Something i wish Prototype would implement. And while it may not add a LOT of overhead, Prototype's aliasing so many methods just feels a bit sloppy. Just my opinion. -joe t. --~--~-~--~~~---~--~~ 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: asynchronous file upload
If you can't utilize a Flash solution, the only other way is an IFRAME. i had a need for this too, and spent a long time developing quite an elaborate Prototype-based JS class for the client side, and a PHP handler on the server side. If you're interested, let me know and i'll be happy to share (i'll have to work on more detailed docs though). Maybe it'll be useful, maybe not. -joe t. On Jan 14, 10:58 am, jason maina jason.ma...@gmail.com wrote: Hi all, Cutting to the chase, how do I do an asynchronous file upload, been googling all day with nothing really positive, may be been looking in all the wrong places. Assistance will be Kind regards Jason --~--~-~--~~~---~--~~ 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: Ajax.Request unload
Thanks for responding, and checking the code. i guess i should have noted: i'm also using FirePHP, so there are lines in place sending debug log lines back to Firebug. However, on only this particular call, absolutely nothing gets sent back from the server. Not even a log line saying the PHP script was executed. No SOP violation (Internal.fileList.Path is correct), i've adjusted all Internal references to be prefixed by window, though you are correct, there are no other Internal objects in that context. In a bizarre twist, if i create a new button in my application and observe click to the EXACT same block of code, it executes flawlessly. -joe t. On Jan 8, 5:27 am, T.J. Crowder t...@crowdersoftware.com wrote: Hi Joe, The client-side code looks okay to this second pair of eyes. (You might want to put window. in front of Internal in the Ajax.Request constructor, just for consistency as you've done it everywhere else. But I'm assuming you don't have some other Internal defined in scope, and so it should be using the same one anyway.) I'd suggest the usual things: Check that window.Internal.fileList.Path really has the correct path and that it's not violating SOP; temporarily try replacing that path with a static file path to eliminate issues in the server-side processing; put debugging checks on the server-side resource it's calling; the usual sort of stuff. I suspect an issue with the server-side resource. But the client-side part looks okay, FWIW. -- T.J. Crowder tj / crowder software / com On Jan 7, 6:59 pm, joe t. thooke...@gmail.com wrote: i have the following: Event.observe(window,'unload',function(){ if (window.Internal window.Internal.doUnload){ (new Ajax.Request(Internal.fileList.Path,{ asynchronous:false, method:get, parameters:{do:unload,task:$_GET.p}, onSuccess:function(t){alert('Success: ' + t.responseText);} })); alert('Wait!'); } }); The Wait alert at the end is just for testing. It does fire. The problem is, the Ajax call does not seem to work at all. Firebug tells me the Ajax block is executed, the onSuccess alert even fires. But t.responseText is always empty, and the actions i've defined in my server-side code are not happening. Any takers to try helping me track this down? -joe t. --~--~-~--~~~---~--~~ 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: Anchor event
Simple answer is there's no defined HTML event for arrival as you describe. You might try using Function#delay to simulate it. Something to the effect of: var arrival_function_reference = function(a, b, c ,d){ ... }; $('source_a).observe('click', function(){ arrival_function_reference.delay(0.5, any, args, you, need); // Whatever time delay you think appropriate } ); Or if you wanted it to feel more fluid you could stick Effect.ScrollTo from Scriptaculous into the click observer: $('source_a).observe('click', function(event){ event.stop(); // Prevent the default Event from going to the href Effect.ScrollTo('destination_a', {duration:0.5}); // Whatever time delay you think appropriate arrival_function_reference.defer(any, args, you, need); } ); In this case use defer to make your arrival function wait until Javascript has finished scrolling the document to the destination. Completely untested, but maybe it helps get you started. -joe t. On Jan 7, 7:37 pm, tmarin teimat...@gmail.com wrote: I want to execute some code when a user reaches a fragment anchor (the # part of a link), is there any event for this? Thanks in advance tmarin --~--~-~--~~~---~--~~ 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: Ajax.Request unload
i presume the page hasn't already unloaded, because the document is still visible, Firebug can still break at my designated markers, the alert('Wait!') line still executes AFTER the Ajax call, and only after i clear the alert does the page actually clear. Being that i'm setting {asynchronous:false}, i believe that alert won't execute until the Ajax is complete. If i place this particular block in beforeunload, i have no way to tell the PHP if the user has elected to continue unloading or has canceled the unload. The PHP in this case cleans up files the user has uploaded while on this page. Since i can't utilize the beforeunload confirm's return value, the user's files would get cleaned up even if they cancel the unload. -joe t. On Jan 8, 9:47 am, Walter Lee Davis wa...@wdstudio.com wrote: Perhaps the unload event has already happened and the page is gone? What happens if you change this event to beforeunload? Walter On Jan 8, 2009, at 9:41 AM, joe t. wrote: Event.observe(window,'unload',function(){ --~--~-~--~~~---~--~~ 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: Ajax.Request unload
DAMMIT! i found the bugger. It was a similar piece of PHP in a different file that gets called when the page LOADS! Everything was getting cleaned up before the piece i'm examining could ever happen. By the way, Firebug WAS reporting the FirePHP logs. It just happens that it was displaying them when the next page loaded. Kinda weird, easy to miss. Anyway, thanks to both of you for your help. -joe t. On Jan 8, 10:41 am, joe t. thooke...@gmail.com wrote: i presume the page hasn't already unloaded, because the document is still visible, Firebug can still break at my designated markers, the alert('Wait!') line still executes AFTER the Ajax call, and only after i clear the alert does the page actually clear. Being that i'm setting {asynchronous:false}, i believe that alert won't execute until the Ajax is complete. If i place this particular block in beforeunload, i have no way to tell the PHP if the user has elected to continue unloading or has canceled the unload. The PHP in this case cleans up files the user has uploaded while on this page. Since i can't utilize the beforeunload confirm's return value, the user's files would get cleaned up even if they cancel the unload. -joe t. On Jan 8, 9:47 am, Walter Lee Davis wa...@wdstudio.com wrote: Perhaps the unload event has already happened and the page is gone? What happens if you change this event to beforeunload? Walter On Jan 8, 2009, at 9:41 AM, joe t. wrote: Event.observe(window,'unload',function(){ --~--~-~--~~~---~--~~ 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: Event.observer with mouseup?
Another alternative is to use Prototype's Curry function which let's you create new functions with default arguments. So you could write: Event.observe(window, 'mouseup', alert.curry('hi')); Joe As long as you know what curry does, I think this is more obvious for really simple examples like this. On Jan 3, 10:50 am, T.J. Crowder t...@crowdersoftware.com wrote: Also any reference to a function inside of an observer needs to be in the form of an anonymous function, not a literal function itself. Doesn't have to be anonymous. Named functions are fine: function myMouseUpThingy() { alert('Howdy'); } // later Event.observe(window, 'mouseup', myMouseUpThingy); The critical thing is that you need to pass in a function *reference*. -- T.J. On Jan 3, 4:45 pm, Walter Lee Davis wa...@wdstudio.com wrote: Try doing this instead: //put the following in a script block near the bottom of your html var foo = function(){ alert('howdy') }; Event.observe(window,'mouseup',foo); Note that the function is called Event.observe, not Event.observer. Also any reference to a function inside of an observer needs to be in the form of an anonymous function, not a literal function itself. You could have done this as well: Event.observe(window,'mouseup',function(){alert('howdy')}); It's a subtle distinction, but it becomes much more important in a non- trivial example, because an anonymous function won't get its input variables (and won't be called, either) until it is invoked. Then it uncloaks, does its business, and vanishes again. Walter On Jan 2, 2009, at 1:30 PM, Per wrote: Hi, I'm new to protocoljs, but it's this thing I'm trying to do, and it doesn't work. It drives me mad. Anyway, I try to do this with protocoljs: body onmouseup=alert('hi'); This was how I wrote it, but it doesn't work: Event.observer(window,'mouseup',alert('hi')); What is the right way to do it? Thank you! --~--~-~--~~~---~--~~ 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: Bug/Issue with autocompleter in IE7, first request doesn't appear, subsequent requests do
I think I found closer to the root cause of the issue. In prototype.js I made a small change to getOffsetParent which fixed my issue: The line: while ((element = element.parentNode) element != document.body) Becomes: while ((element = element.parentNode) element != document.body element.style) I'm not sure how or why, but somehow an element gets sent to this method which does not have a style attribute. The causes the line: if (Element.getStyle(element, 'position') != 'static') To throw an exception. I couldn't pinpoint what had changed in prototype to cause this behavior. We are using prototype 1.6.0.1 just fine, but 1.6.0.3 on IE6 causes us problems here. Does anyone else have thoughts? Joe On Nov 18, 4:10 pm, Joe Athman [EMAIL PROTECTED] wrote: We are having this exact same problem, although it only seemed to pop up with version 1.8.2. We have been using 1.8.1 just fine. Does anyone else see this? Joe On Nov 4, 4:28 pm, Tom [EMAIL PROTECTED] wrote: I have found an issue with theautocompleterin IE7 where the first issued requests doesn't appear in the drop down box while the second and subsequent requests do. The first request does successfully issue the ajax request and gets a response, it just isn't displayed. This works fine in FF and Chrome. I'm using 1.8.1 of script.aculo.us IE 7.0.5730.13 The demo on the website forautocompleterworks fine. Example code that doesn't work. User enters a partial zipcode and gets back a list of matching zipcodes (+ city and state) code div input type=text size=30 maxlength=10 name=test_zip id=test_zip value= span id=test_zip_indicator style=display:noneSearching.../ span div id=test_zip_choices class=autocomplete/div /div script type=text/javascript language=javascript new Ajax.Autocompleter(test_zip, test_zip_choices, ../ajax/zip_list, {minChars: 3, paramName: zip, indicator: test_zip_indicator}); /script /code This is a sample response back for '024'. code ul li02420span class=informalbr/nbsp;nbsp;nbsp;LEXINGTON, MA/span/li li02421span class=informalbr/nbsp;nbsp;nbsp;LEXINGTON, MA/span/li li02445span class=informalbr/nbsp;nbsp;nbsp;BROOKLINE, MA/span/li li02446span class=informalbr/nbsp;nbsp;nbsp;BROOKLINE, MA/span/li li02447span class=informalbr/nbsp;nbsp;nbsp;BROOKLINE VILLAGE, MA/span/li li02451span class=informalbr/nbsp;nbsp;nbsp;WALTHAM, MA/ span/li li02452span class=informalbr/nbsp;nbsp;nbsp;WALTHAM, MA/ span/li li02453span class=informalbr/nbsp;nbsp;nbsp;WALTHAM, MA/ span/li li02454span class=informalbr/nbsp;nbsp;nbsp;WALTHAM, MA/ span/li li02455span class=informalbr/nbsp;nbsp;nbsp;NORTH WALTHAM, MA/span/li /ul /code The problem appears to be down in control.js. Here is my work around / fix. (478 is our internal subversion number for the original control.js). code === --- controls.js (revision 478) +++ controls.js (working copy) @@ -65,11 +65,16 @@ function(element, update){ if(!update.style.position || update.style.position=='absolute') { update.style.position = 'absolute'; + try { Position.clone(element, update, { setHeight: false, - offsetTop: element.offsetHeight - }); + offsetTop: element.offsetHeight}); + } catch (exception) { + Position.clone(element, update, { + setHeight: false, + offsetTop: element.offsetHeight}); } + } Effect.Appear(update,{duration:0.15}); }; this.options.onHide = this.options.onHide || /code The first Position.clone call fails for some reason under IE7 while the second time it succeeds and the drop down complete box appears. If there is a better place to report or post this please let me know. Tom --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Event.observe doesn't work on window scroll event
Well don't I feel foolish! That solved my problem. I guess I needed more coffee! Thanks, Joe On Mon, Nov 17, 2008 at 9:37 PM, kangax [EMAIL PROTECTED] wrote: On Nov 17, 12:16 pm, Joe Moore [EMAIL PROTECTED] wrote: I'm trying to use the bind to the windows.onscroll event with Event.observe, but it doesn't work. No error is reported. Here is a small bit of JavaScript I am using: function initPage() { Event.observe(window, scroll, function() { alert(Hello World); }); `window` needs to be an actual reference, not a string representing id of an element : ) Hence, Event.observe(window, 'scroll', function() { alert('Hello, World!'); }) [...] -- kangax --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---