[Proto-Scripty] How to separate markup from javascript while handling JSON data
Hi folks, I'm not an expert on front-end development and if this is the wrong group to post, please point me in the correct direction. I'm looking at ways to separate the HTML layout of a page in javascript from JSON data that I receive from the server. What are the ways to render the JSON on the client? Most of the code samples I've seen involve displaying the received JSON seem to have an intimate knowledge of how the html is laid out and which elements and types used to display the data. Typically what I see is something similar to: function makeHttpRequest() { httpRequest.open("GET", url, true) httpRequest.onreadystatechange = updatePage; httpRequest.send(); } function updatePage() { if (xmlHttp.readyState == 4) { eval("var response = ("+request.responseText+")"); for(var i in response.data.row.items) { document.getElementById("body").innerHTML += ""; for(var j in response.data.row.items[i].item) { document.getElementById("body").innerHTML += ""+ response.data.row.items[i].item[j] +""; } } } } Assuming that our view consists simple HTML with separate javascript & CSS files, this approach seems to intrinsically cause coupling of the markup with javascript. Following this approach, every section of a page that needs to fetch data from the server would have a different 'updatePage' to handle the response. In addition, if the layout of the page changed from a 'div' to some other type of tag, you have to remember to go and modify the javascript. I've read about the 'Template' object under prototype and I suppose one thing you could do is have the server send back template string and with the id of the element to update along with rest of the JSON data and then use it after deserializing the data. Is there a better way to achieve this separation using prototype/ scriptaculous? Thanks, Justin --~--~-~--~~~---~--~~ 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: How to separate markup from javascript while handling JSON data
Yes very much MVC style separation of concerns. I didn't want to reinvent the wheel with how my view implementation is done and being new to the front-side of things, I wasn't sure which direction to take, but certainly one that would entail the least amount of duplication of code and as much separation between the layers as feasible. One of the most frustrating aspects of this discovery and working with javascript is the abundant amount of advice and sample code that doesn't have much back bone for good programming practices. So while I certainly accept a pragmatist's approach to solving a problem, I also would prefer to have some sort of base pattern or mechanism so I don't have to write a redundant but slightly variant code to render the data.. Plus, I figured that many others before me would have had to deal with this problem. I've perused through few AJAX books as well and maybe I haven't looked at the right book or correct section, but I didn't notice anything that would be of help for this scenario. Is there one that's recommended above others? Justin On Sep 11, 3:55 pm, "T.J. Crowder" <[EMAIL PROTECTED]> wrote: > Hi Justin, > > If you're thinking MVC, off-the-cuff I'd say think of the client-side > script as the Controller, the HTML as the View(s), and the server-side > stuff as the Model. So an Ajax request is a message from the > Controller to the Model. The data coming back knows nothing about the > Views; the Controller (the JavaScript on the page) is responsible for > taking the data and updating the Views, which are the various HTML > elements involved in the UI. So in an MVC app, it's probably not > appropriate for the JSON to specify the HTML element that gets updated > with it; instead, it's up to the JavaScript code on the page to handle > that association. (Although that depends; if the ID on the element is > data-derived, it could easily come from the model.) > > But that's just one interpretation. The server-side stuff could be > doing more of the heavy-lifting, so what you're seeing from the client > end of things is mostly View implementation with a bit of Controller > thrown in, with the rest on the server out of your immediate sight. A > lot of MVC involves blurring of the boundaries. > > When you say "Most of the code samples [you've] seen...", remember > that most of the code you've seen is either sample code, or code > written "pragmatically" (whatever that's supposed to mean this week), > or code written by juniors who wouldn't know MVCs from ABCs (e.g., > alphabetti spaeghetti, or "Spaghettios" for our American friends). > > Or, of course, people could be using a different model entirely, MVC > not being the only game in town (although it's a pretty good one). > > Rambling my way to my point, it's up to you. It's up to how you > structure the data exchange between the client and server, how you set > up your pages, and how you write your script. If you want to do > strict separation of concerns , there's no reason you can't, and in > fact the nature of the beast makes it a bit easier to think that > through. > > (The Template class can certainly help with your View implementation.) > > FWIW, > -- > T.J. Crowder > tj / crowder software / com > > On Sep 11, 8:25 pm, Justin <[EMAIL PROTECTED]> wrote: > > > Hi folks, > > I'm not an expert on front-end development and if this is the wrong > > group to post, please point me in the correct direction. > > > I'm looking at ways to separate the HTML layout of a page in > > javascript from JSON data that I receive from the server. What are the > > ways to render the JSON on the client? > > > Most of the code samples I've seen involve displaying the received > > JSON seem to have an intimate knowledge of how the html is laid out > > and which elements and types used to display the data. Typically what > > I see is something similar to: > > > function makeHttpRequest() > > { > > httpRequest.open("GET", url, true) > > httpRequest.onreadystatechange = updatePage; > > httpRequest.send(); > > > } > > > function updatePage() { > > if (xmlHttp.readyState == 4) { > > eval("var response = ("+request.responseText+")"); > > > for(var i in response.data.row.items) > > { > > document.getElementById("body").innerHTML += " > id='icon'>"; > > > for(var j in response.data.row.items[i].i
[Proto-Scripty] Re: How to use after finish?
Really Easy Example: new Effect.Fade('link', { duration: 0.2, afterFinish: function() { new Effect.Show('link',{duration:0.2}); } }); That hides and shows a link. Also as 2 cleaner code: var show_me = function() { new Effect.Show('link',{duration:0.2}); } new Effect.Fade('link', { duration: 0.2, afterFinish:show_me }); i might me slightly off on the syntax, but this is the method i use. On Nov 4, 10:34 am, Anna P <[EMAIL PROTECTED]> wrote: > Hello! > I'm kind of new to scriptaculous (still learning how to pronounce > it;)) > I don't know how to achieve loop efect on a Effect.move action. > It can be seen on :www.apaw.pl > > I used Effect.move to move transaprent picture from right to left side > of the bigger picture. It works great. Now what I want to do is to > loop this action. So when picture achieves left side, I want it to > begin moving from right side again. > > How to do it? > Moving div with the transparent picture is placed in a div with bigger > picture like this: > > > src="/img/aranzacje-wnetrz1.jpg" alt="" title="Hotel i restauracja" /> > > > > > And I call the move action when the page is loaded: > > > window.onload = function() { > movePhoto(); > } > function movePhoto() { > new Effect.Move('aranzacja', {x:-209,y:0,duration:4}) > } > > > Where should I place the afterFinish function, with what parameters? > I would be very greatful for help. --~--~-~--~~~---~--~~ 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: Strategies for replacing Elements in realtime
I would reccomend using the dom to be *safe*. For instance, in a select box if you just try to add "" tags into the "" container IE will not detect the new elements. you should use the javascript add option methods. In general both methods work, but i find using JS is sometimes safer. I guess in general if its really small nothing is easier and faster than assigning what you want to an elements.innerHTML. and in more complex or sensitive cases it can depend. On Feb 24, 1:48 pm, Lee Jenkins wrote: > Hi all, > > Pretty new to javascript and prototype. Been developing windows software for > years though. > > At any rate, I have a question and if it's too javascript related and > considered > OT, please let me know and/or direct me to an appropriate group for > discussion. > > Assume that I have DIV with several elements such as TextBox, Combo Box, etc > and > I want to update one specific widget within the DIV, would you recommend > updating the widget through the DOM or replacing it's markup? Either way, the > data would be coming in the response of an AJAX request. Seems to me that if > I > wanted to juse replace it's markup, I would have to site the elements within > DIV's themselves. > > If the DIV has several controls on it, I'd prefer not to have to re-display > the > entire contents with an innerHTML call, but I am unsure of the best way to > update a single widget contained within another element like a DIV. > > Thanks for advise, > > -- > Warm Regards, > > Lee --~--~-~--~~~---~--~~ 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: newbie scriptaculous query
use firebug, and check the response from the server. (make sure error reporting is on) if the return from the ajax query is an error... then its server side. I suspect its a php related time error, you should check those scripts. NOW if its a local javascript error, (not a bad return from the server) it may be that you have not initalized the control correctly does this help? On Feb 25, 10:10 am, Bhudda Ben wrote: > I am newbie to AJAX and scriptaculous (I know and use php & js) with > what I hope is easy question. I am building a new homepage for my > company with the idea that a basic shell of links and other widgets is > always in browser, but center section changes to provide other > commonly used company widgets. I have not yet started to play with > center section - the main use of AJAX - but, and here is problem: > > Company desires automatically updating time widget at bottom of page > - this feature was already in use implemented in scriptaculous at our > London office; this is why I am starting with scriptaculous rather > than some other AJAX implementation. I stole the following code: > > Head section: > > > new Ajax.PeriodicalUpdater('clock', 'required/clock/gettime.php', > {asynchronous:true, frequency:60}); > > > And of course, brought all the scriptacous code over to required/lib. > > At bottom of page London original was: > > gettime.php"); ?> > > I used that and also tried: > > > //include clock footer > include ("required/clock/gettime.php"); > ?> > > > (since I had the whole in table, thought I might need to go to span > instead of div) > > That's it - works in London, does not work in NY for me and London guy > who did original long gone. > > The only other difference is London site runs on Windows; mine runs on > Linux - is that a prob? --~--~-~--~~~---~--~~ 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: Crop Image With Preview
if you just want to show a portion of an image set the div to have overflow hidden, and to the size you want. then you can use css to absolutely position the img. you can also stretch / alter the image by changing the size of the img. if you want to SAVE this image (submit the cropped portion to the server) i don't know how off the top of my head. I know there is a way i just have never had to do this. Hope that helped! here is one example or div#mainimage { overflow:hidden; height:200px; width:200px; } volia :) On Mar 3, 5:06 am, calitom wrote: > Hi, > > I wanted to know how you do to display the croped part of an image? > I tryied to crop an image in php, with imagecopyresamled, but with big > images it didn't work due to my server memory limit... > > How can i do to display just a part of an image with top left position > of area to display and width/height of the area? > > In fact i want to display a part of an image in a div... --~--~-~--~~~---~--~~ 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 in scriptaculous-js-1.6.4
If the server-side code returns something like: foobar helloworld Then these spaces will absolutely be preserved in the list that the Autocompleter returns. Once that value shows up in your input box, the non-breaking spaces will be just normal spaces. If you save that data and the preservation of spaces is important, then it is your job to handle it appropriately. There is no bug in this behavior. You can use whatever HTML code you want for the returned HTML, but you will need to alter the new Ajax.Autocompleter(...) code so that it looks for the correct tag, by default it looks for a . Also, you cannot have one or more elements that are stand-alone, they must be inside a or . -justin --~--~-~--~~~---~--~~ 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: Form.Element#setValue
On Mon, Sep 8, 2008 at 3:35 PM, Alexey Bass <[EMAIL PROTECTED]> wrote: > What I'm asking is that why this is not documented on Prototype site. Maybe it should be mentioned, but really Element#update is just using innerHTML to update the contents of a node, and since innerHTML cannot be used to update form elements, I've always thought it goes without saying that you use Element#update for most stuff except form controls. -justin --~--~-~--~~~---~--~~ 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: Assigning OnClick Events To Options On A Select Menu?
Why don't you just observe the 'change' event on the select? Works in all browsers, and is the standard method for observing select boxes. One tip, where you do: >var someNodeList = > $('game_types').getElementsByTagName('option'); >var nodes = $A(someNodeList); >nodes.each( Can really be: $('game_types').select('option').each(function(options){ }); -justin --~--~-~--~~~---~--~~ 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: Bug in scriptaculous-js-1.6.4
On Mon, Sep 8, 2008 at 4:42 PM, Jack D <[EMAIL PROTECTED]> wrote: > When I type the name in the text box, the values get dispalyed from > database. However, it doesn't show the space even there while I'm looking at > the data & scrolling down the results!! I don't think you are adding the before displaying the results because I just did the same and it worked fine. Make your HTML response look *exactly* like I specified in my previous response and I guarantee it will work. -justin --~--~-~--~~~---~--~~ 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: Bug in scriptaculous-js-1.6.4
On Mon, Sep 8, 2008 at 6:06 PM, Jack D <[EMAIL PROTECTED]> wrote: > This problem exist only with IE. It always shows 1 space. I didn't realize it was just an IE thing. I'm sorry I can't help right now because I don't have IE. I might be able to look into it a bit more tomorrow. -justin --~--~-~--~~~---~--~~ 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: Ajax.Responders: API is confusing!
On Tue, Sep 9, 2008 at 8:05 AM, bluezehn <[EMAIL PROTECTED]> wrote: > - but right now I can't register an onFailure. Maybe it's just not getting invoked when you are expecting it to? You might want to use the onException callback instead, or even have a global onComplete handler and then within that method you can check the status and handle appropriately. The reason I say this is because onFailure and onException do not get invoked *all* the time, vs. onComplete does. -justin --~--~-~--~~~---~--~~ 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: a problem with IE
In your Ajax requests, are you specifying a complete URL or a relative URL? All URLs you provide to the Ajax request should be relative. Like: new Ajax.Request('/your/path'); Instead of: new Ajax.Request('http://www.domain.com/your/path'); -justin --~--~-~--~~~---~--~~ 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: Get value from table cell when table row have checkbox checked
I don't quite understand, when you click the checkbox in the first cell what are you trying to sum? -justin --~--~-~--~~~---~--~~ 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: a problem with IE
On Thu, Sep 11, 2008 at 11:21 PM, zaher ghaibeh <[EMAIL PROTECTED]> wrote: > > can i ask you where you got this rule from ? It's not really a rule, just a good practice so that you can move your code from server to server and your code will work without alteration. If you always hardcode the domain then you'll have branch your code all over the place for production vs. dev/test. -justin --~--~-~--~~~---~--~~ 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: User types freely on webpage and it jumps to a link...
Yes you could just setup a keyup observer on the entire document, the two problems that I see right away is that any keyboard shortcuts the user already uses may or may not work any longer depending on how you write your code. Secondly, depending on the size of the list of links, the script may take a while to process each keypress. There's a few other issues I'd be concerned with, but the above is probably enough to think about for now. Having a textbox to type into would solve the first problem. Keeping a copy of the list of links in a local variable would help to solve the second problem. -justin --~--~-~--~~~---~--~~ 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: autocompleter does not work with contents pasted by using mouse
On Fri, Sep 12, 2008 at 11:57 AM, Jack <[EMAIL PROTECTED]> wrote: > Question 1: > I've observed that when copy paste the search string using keyboard > in the text box, it displays hints. However, if I copy paste the same > stuff using mouse, then the hints are not displayed at all. I think > the even is placed on keydown or something. The Autocompleter listens for the keydown event to trigger Ajax request. To accommodate the event you are describing, you could wrap the Autocompleter#baseInitialize method and add an additional mousedown or mouseup listener bound to the same method that the keydown listener invokes. > Question 2: > I kept minChars to 2 & I entered "ab" in text box, it shows hints > for all matching "ab"s. If I enter "a " (a followed by a space), it > does not even invoke anything & does not display hint. Is this a bug? > Why space is excluded? Any workaround? The reason for this is because the input is stripped (leading and trailing spaces removed) which means that a single character followed by any number of spaces is still considered a single character. The default minChars value is 1, if you're going to be typing a character then a space you might want to just leave the default value instead of using minChars:2. Alternatively, you can override the getToken method to return an unstripped string. -justin --~--~-~--~~~---~--~~ 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: autocompleter does not work with contents pasted by using mouse
You do not want to alter the source code of scriptaculous, or at least I would not recommend it since whenever you update your library to a newer version you will lose those changes. You need to *extend* those classes/modules in a separate JS file that is included after the controls.js file is included. I am not able to spend a lot of time helping you with code, but I can offer some UNTESTED stuff. Note that I am using Function#wrap (http://prototypejs.org/api/function/wrap) and Object#extend (http://prototypejs.org/api/object/extend) to help. Typically this code would go in your main application JS file or a overrides JS file. Autocompleter.Base.prototype.baseInitialize = Autocompleter.Base.prototype.baseInitialize.wrap(function(){ var args = $A(arguments), proceed = args.shift(); // call the original baseInitialize method with any passed in arguments proceed.apply(this, args); // attach a mouseup listener, a brute-force way to observe for a mouse copy/paste event Event.observe(this.element, 'mouseup', this.onKeyPress.bindAsEventListener(this)); }); Autocompleter.Base.addMethods({ getToken: function() { var bounds = this.getTokenBounds(); // same code as the original getToken method except we're not calling strip() on the string return this.element.value.substring(bounds[0], bounds[1]); }, }); On Fri, Sep 12, 2008 at 12:50 PM, Jack D <[EMAIL PROTECTED]> wrote: >Will there be any impact on any other part of the autocompleter? I mean > what would be the side efftect of the above 2 soluns? The side effect of the additional observer is it will fire when *ANY* mouseup event is fired whenever the autocompleter input control has focus. The side effect of overriding the getToken method is that literally whatever is input into the autocompleter control will be passed through to the server. Leading spaces, trailing spaces, etc... -justin --~--~-~--~~~---~--~~ 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: $$( ) returns hidden/removed tr tags
Can you post your code? I have done what you are talking about many times (removing rows and restriping them) and never ran into this issue. I don't think there is a bug in prototype. -justin --~--~-~--~~~---~--~~ 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: recommended css forms
Have you looked into Prototip2? http://www.nickstakenburg.com/projects/prototip2/ -justin --~--~-~--~~~---~--~~ 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: $$( ) returns hidden/removed tr tags
On Tue, Sep 16, 2008 at 6:51 AM, ericindc <[EMAIL PROTECTED]> wrote: > tr.remove( ); // remove the row > // delay somehow > updateColors( ); // set the backgrounds Are you not updating your collection after you remove the rows? var rows = $$('table tr') console.log(rows.size()); rows.first().remove(); console.log(rows.size()); // inaccurate! rows = $$('table tr'); console.log(rows.size()); // see the difference? -justin --~--~-~--~~~---~--~~ 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: recommended css forms
On Tue, Sep 16, 2008 at 11:33 AM, Jimmy Brake <[EMAIL PROTECTED]> wrote: > nor anything for locking out the rest of a > page while using the form(I could have missed it). If you want to do "lockout" style forms, then the lightbox approach is the best way. -justin --~--~-~--~~~---~--~~ 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: Need Help with Ajax.Request Parameters
On Tue, Sep 16, 2008 at 10:57 AM, TheZ <[EMAIL PROTECTED]> wrote: > parameters : { > user : { >first:'first_name', >last:'last_name' > } > } The Ajax.Request object does not handle nested parameters. You should use a string instead. 'user[first]=first_name&user[last]=last_name' This is happening because the AjaxRequest parses the parameters with Object#toQueryString which does not parse nested objects. http://prototypejs.org/api/object/toquerystring -justin --~--~-~--~~~---~--~~ 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: $$( ) returns hidden/removed tr tags
On Tue, Sep 16, 2008 at 4:10 PM, ericindc <[EMAIL PROTECTED]> wrote: > > Yes, I'm certain. I call a seperate function each time that does $$ > ('tbody tr').each. As far as I know, this should repopulate the list > each time, right? What browser/version are you using and can you please post a link to a demo page that is displaying this behavior? -justin --~--~-~--~~~---~--~~ 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: $$( ) returns hidden/removed tr tags
On Tue, Sep 16, 2008 at 4:17 PM, ericindc <[EMAIL PROTECTED]> wrote: > When I click the delete text, I want the whole row gone, but it > currently just deletes the cell. How do I get to the row level? function removeRow(referenceElement){ referenceElement = $(referenceElement); var table = referenceElement.up('table'); alert(table.select('tr').size()); referenceElement.up('tr').remove(); alert(table.select('tr').size()); } -justin --~--~-~--~~~---~--~~ 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: $$( ) returns hidden/removed tr tags
If all your HTML and JavaScript is in one file, you can put it in pastie and then provide a link. See here: http://pastie.org/ Since you're using Prototype, you should take advantage of it's helper methods to traverse the DOM, such as Element#up and Element#down instead of messing with parentNode ... especially since the element returned from parentNode won't be a Prototype-extended element when in IE. Element#up: http://prototypejs.org/api/element/up -justin --~--~-~--~~~---~--~~ 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: $$( ) returns hidden/removed tr tags
Just as I thought, you are calling your function setRowFeatures immediately instead of waiting until the row is removed. Due to implementation problems in browsers like IE, I really recommend against using effects on table elements. Take these 2 lines of code: row.fade(); //{afterFinish: function(fx){ fx.element.remove()}}); setRowFeatures(); And change them to: row.remove(); setRowFeatures(); If you insist on using an effect to remove the row, you need to wait until the effect has completed before you process the rows. -justin --~--~-~--~~~---~--~~ 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: $$( ) returns hidden/removed tr tags
Like I said in my first post, delay invoking your function for the same amount of time as the effect. There's a few different ways to achieve this, but the goal is don't do any row counting/alteration/etc until after the effect is complete. row.fade({duration:0.5}); setTimeout(function(){ row.remove(); setRowFeatures(); }, 500); -justin --~--~-~--~~~---~--~~ 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: submiting form created by Ajax.inPlaceEditor
On Tue, Sep 16, 2008 at 2:21 PM, Tokeiito <[EMAIL PROTECTED]> wrote: > > Is there a way to triger submit by using object i get after: var > editor = new Ajax.InPlaceEditor(...); ? You might try calling editor.handleFormSubmission(), although that method expects an event argument it appears to be safe to call it without arguments. -justin --~--~-~--~~~---~--~~ 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: Disable form submission
To add to the list of ideas, I would recommend you override the Ajax.InPlaceEditor#checkForEscapeOrReturn method to do what you want since that's where this submit event is getting fired from. Ajax.InPlaceEditor.addMethods({ checkForEscapeOrReturn: function(e) { if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return; if (Event.KEY_ESC == e.keyCode) this.handleFormCancellation(e); else if (Event.KEY_RETURN == e.keyCode) return; //this.handleFormSubmission(e); } }); Ideally you would pass in an extra option when instantiating the IPE and then in the above code snippet you could check for the existence of an option before blocking the form submit event. -justin P.S. Your users might see this as a bug since submitting a form on "return key press" is expected behavior. --~--~-~--~~~---~--~~ 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: toHTML() doesn't work
On Wed, Sep 17, 2008 at 8:00 PM, yawnmoth <[EMAIL PROTECTED]> wrote: > It's Object#toHTML: > > http://www.prototypejs.org/api/object/tohtml Yes, like Object.toHTML(someObject), not someObject.toHTML(). --~--~-~--~~~---~--~~ 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: issues with getElementBySelector
On Thu, Sep 18, 2008 at 10:09 AM, Matt Foster <[EMAIL PROTECTED]> wrote: > > bluezehn, the $$ method just executes getElementsBySelector on the > document. http://prototypejs.org/api/element/getelementsbyselector Doesn't $$ use Element#select? Nobody should be using getElementsBySelector if you're running Prototype 1.6 or higher. -justin --~--~-~--~~~---~--~~ 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: AJAX autocompleter
On Thu, Sep 18, 2008 at 2:30 PM, Jack D <[EMAIL PROTECTED]> wrote: > Hello, > > any clue regarding memory leak? What version of IE? IE is well known for it's memory leaks with JavaScript. I recommend using a memory leak tool for IE rather than just looking at the task manager. sIEve is one good tool I have had success with in the past. This is probably one of the best named memory leak tools ever to exist. :) -justin --~--~-~--~~~---~--~~ 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: AJAX autocompleter
On Thu, Sep 18, 2008 at 3:02 PM, Jack D <[EMAIL PROTECTED]> wrote: > Hi Justin, > I'm using IE 6. In the memory leak tool which you've specified, if the > #leak is showing some number, then does it mean that its a memory leak? I guess, but with IE there will be all sorts of stuff marked as #leak. You'll have to do a bit more digging than that. I have only used this tool once when I had a bad memory leak (over a year ago) so I'm not going to be able to help. -justin --~--~-~--~~~---~--~~ 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: how to change selectedIndex?
Why don't you use Prototype methods? $(field).select('select').each(function(control){ control.selectedIndex = 0; }); -justin --~--~-~--~~~---~--~~ 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: How to get a form elements parent form?
Check out the form-related methods Prototype provides: http://prototypejs.org/api/form -justin --~--~-~--~~~---~--~~ 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: How to get a form elements parent form?
On Fri, Sep 19, 2008 at 11:01 AM, Hector Virgen <[EMAIL PROTECTED]> wrote: > Except for Ajax methods. :) Not really though, classes and object literals use camel case (upper camel case) and everything else (methods and variables) use mixed camel case (lower camel case), where the first character lower case. Ajax is a class Ajax.Base is a subclass of Ajax Ajax.Request is another subclass. Ajax.Request#onStateChange is a method of Ajax.Request etc... --~--~-~--~~~---~--~~ 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: binding to preserve 'this' keyword scope
If you just bind your observer to the current instance of "this" when you are setting up your observer, everything will work fine. Here is a contrived example to illustrate usage. // this code is untested var Foo = { initialize: function(){ this.message = 'I am who I say I am'; this.body = document.body; // attach to a normal method this.body.observe('click', this.bodyClicked.bindAsEventListener(this)); // attach to an anonymous method this.body.observe('keypress', function(event){ alert('you pressed a key, here is my message: ' + this.message); }.bindAsEventListener(this)); }, bodyClicked: function(event){ alert('you clicked on my body, here is my message: ' + this.message); } }; Foo.initialize(); --~--~-~--~~~---~--~~ 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: understanding how events are registered
Let's see that HTML. --~--~-~--~~~---~--~~ 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: Javascript disabled & security
On Sun, Sep 21, 2008 at 4:21 PM, jason maina <[EMAIL PROTECTED]> wrote: > what are the security concerns at this point? What do you mean? How does disabling JavaScript impact the secureness of a webpage? -justin --~--~-~--~~~---~--~~ 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: Javascript disabled & security
On Sun, Sep 21, 2008 at 7:37 PM, jason maina <[EMAIL PROTECTED]> wrote: > > In relation to cross browser hacking. I think you'll be safe from cross-site scripting if JavaScript is disabled. --~--~-~--~~~---~--~~ 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: Scripts at bottom and 'dom:loaded' event
On Mon, Sep 22, 2008 at 3:47 AM, Olivier Jaquemet <[EMAIL PROTECTED]> wrote: > And most importantly, is it still true if ones follows the Yahoo > Performance Guideline #6, that is put script on bottom of page. > http://developer.yahoo.com/performance/rules.html#js_bottom The technique is an alternative to using page/dom load event listeners and is good for pages with lots of markup. -justin --~--~-~--~~~---~--~~ 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: JSON question
To copy the properties from obj2 into obj1, use: Object.extend(obj1, obj2) to To delete a property, use: delete obj1.key Read more about Object#extend here: http://prototypejs.org/api/object/extend delete is a special operator in JavaScript and not a Prototype thing, read more: http://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Operators/Special_Operators -justin --~--~-~--~~~---~--~~ 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: Element.fire event order
Here's what I rely on to fire dom:loaded events in the order they were attached to the document: Event.register = function(object) { // manage a stack of events to invoke if (!Event.registeredEvents) Event.registeredEvents = $A(); if (!object['initialize']) return; Event.registeredEvents.push(object); // if the observer was already created, don't create another one if (Event.domLoadedObserverCreated) return; Event.observe(document, 'dom:loaded', function(){ // for each item in the stack, call the initialize method Event.registeredEvents.each(function(object){ object.initialize(); }); }); Event.domLoadedObserverCreated = true; }; // Example usage: var Foo = { initialize: function(){ // the dom:loaded event has fired } }; Event.register(Foo); var Bar = Class.create({ initialize: function(){ } }; Bar.initialize = function(){ }; Event.register(Bar); Some might think that I'm crazy to maintain a custom stack of dom:loaded events, but it works reliably in all major browsers, fires events in the order you expect (in all browsers) and isn't susceptible to event registration failures in IE when a large number of dom:loaded listeners are created (something I ran into in the past). Given an object, it will auto-invoke the initialize method. This code primarily comes from Andrew Dupont, sans the custom event stack. Advice/suggestions is welcome :) -justin --~--~-~--~~~---~--~~ 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: Scripts at bottom and 'dom:loaded' event
On Tue, Sep 23, 2008 at 7:20 AM, RobG <[EMAIL PROTECTED]> wrote: > Bottom-loading scripts is beneficial where there is a lot of *script* > and you don't want processing of HTML delayed while the script is > loading. Of course if you are depending on your script doing a lot of > stuff before the page is useful, it doesn't get you very far to > display the page more quickly if it's still dysfunctional. You're right, but it's more than just lots of scripts. Any large amount of externals is the problem here, CSS, Images, JavaScript. I wouldn't flat out say that you're doing stuff before the page is useful, attaching listeners is a great thing to do in this situation because a webpage visitor can start clicking on anything immediately, they do not have to wait for images/etc. to load. -justin --~--~-~--~~~---~--~~ 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: yet another show/hide example
I prefer not to nest my code like that, I feel like it is difficult to read and hard to extend/modify (read: fragile), but if that's how you like to read your code and you find it easier to read/write, then that's all that matters. I think if that code works for you now, then you should just be happy with it. Keep writing JavaScript and then revisit this code in a few months and you'll probably have an idea or two for improving it. -justin --~--~-~--~~~---~--~~ 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: yet another show/hide example
Well if you just want to condense it, you can use Enumerable#select. divs.invoke('hide').select(function(div){ return div.id == section_id; }).show(); You can fetch the element that fired an event with event.element() instead of Event.element(event); -justin --~--~-~--~~~---~--~~ 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: Ajax.Autocomplete Questions
On Thu, Sep 25, 2008 at 2:36 PM, ericindc <[EMAIL PROTECTED]> wrote: > First, in the online Ajax.Autocompleter document's Server Return > section, it states that "the server must return an unordered list." > So, in my server side PHP code I literally return a string containing > the unordered list. Autocompleter expects the following: some item some other item ... It also expects a div to exist on the page with the ID that you pass as the second argument when you are instantiating the autocompleter. > Second, I'm having trouble getting my autocomplete code to work > properly in Netscape 7, even though the exact same code works just > fine in IE 6. Are there any known bugs in Scriptaculous that could be > causing this to fail. Not sure about that. I know it works fine in IE6/7, Firefox 2/3, Safari, Opera, Camino, but have never tested nor used NN7. > Third, I've noticed in that typing in my input fast causes the > autocomplete to attempt running but fail. I see my indicator image > flash on and then off, but no results are returned. I've never seen behavior like that. I just tried and it had no problems returning results that matched what I typed, regardless of how fast I typed those two characters. Can you link to a demo page exhibiting these bugs and also let us know what browser/version you are experiencing the problems in? -justin --~--~-~--~~~---~--~~ 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: Effect.Highlight and :hover stops working?
That is happening because the background color of the row is set with inline CSS to be the original background color when the highlight effect is complete. Inline CSS always has priority over CSS in the stylesheet. Maybe you can try using the !important declaration to override it? Note that the :hover pseudo class is not supported in IE6 on any element except an anchor. -justin --~--~-~--~~~---~--~~ 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: Ajax.Autocomplete Questions
On Thu, Sep 25, 2008 at 7:16 PM, ericindc <[EMAIL PROTECTED]> wrote: > The autocompleter only works when the PHP code prints the string, but > based on the documentation, I assumed that the PHP code was expected > to return the string. I don't really understand why you are differentiating between "prints the string" vs. "returns the string". The Autocompleter does not care what you implement your server-side code in, all we're concerned with here is the body of the response from the Ajax request. This is a PHP example that would work: some itemsome other item'; ?> > The site is again on an intranet. I can copy the code to pastie.org > again, but the database connection, etc. won't be available. All the we'd need to see to better help you is the generated HTML, no PHP or anything else server-side specific. -justin --~--~-~--~~~---~--~~ 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: Effect.Highlight and :hover stops working?
You want to use the afterFinish callback and set the background to whatever color you need to. Setting the background color to an empty string will have no effect (at least not when I tested it in Safari). Also the way your setStyle() call is written, it will result in a syntax error since the dash is an illegal character in that context as well as the loose trailing semicolon. Try something like this: var element = $('itemHighlight'); // assuming element with ID of itemHighlight is a TR with an odd or even class element.highlight({ afterFinish:function(effectObject){ if (effectObject.element.hasClassName('odd')) effectObject.element.setStyle('background-color:#fff;'); else effectObject.element.setStyle('background-color:#F1F5F9;'); }}); Also you can simplify your markup and CSS a tiny bit by not worrying about assigning both an odd and even class to each row, just pick one and go with that, for example only add the odd class to every other row, then your CSS is: tr{ background:#F1F5F9; } tr.odd{ background:#fff; } And since your hover color is the same for each row (regardless of if it is odd or even), then you don't need the extra complicated selector (class with hover pseudo class) and just go with: tr:hover{ background:#DADFE4 } Hope this helps. -justin --~--~-~--~~~---~--~~ 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: Does Prototype have a future?
I like Prototype better than any other framework :p -justin --~--~-~--~~~---~--~~ 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: replace an anchor around a tablecell
A structure like that is not valid markup and should be avoided as it can/will produce unexpected behavior. A TD cannot have an anchor as a parent and a TR cannot have an anchor as a direct descendent. Furthermore, outerHTML is a proprietary Microsoft method and is not supported in other browsers. What is the end goal of what you are trying to do here? Why do you say it is required to have an anchor around a TD and what is the purpose of removing the anchor after some click action happens? -justin --~--~-~--~~~---~--~~ 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: Prototype 1.6.0.3 is out
On Tue, Sep 30, 2008 at 3:32 AM, Peter De Berdt <[EMAIL PROTECTED]> wrote: > http://github.com/sstephenson/prototype/tree/master/CHANGELOG Wow that's quite the list of changes guys, thanks so much. Looking forward to trying this out. One quick question, a while back I had integrated a diff from a prototype contributor (kangax I believe) to fix a problem in IE with dom:loaded getting fired prematurely. This diff affected the method fireContentLoadedEvent only, and by comparing my 1.6.0.2 version to the released 1.6.0.2 version, and also comparing with the new 1.6.0.3 version, I can see that the fireContentLoadedEvent has mostly remained unchanged, meaning that I will potentially re-introduce bugs into my application if I upgrade. Is this a valid assumption or am I just missing something here? Thanks again for all your work on this guys! -justin --~--~-~--~~~---~--~~ 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: IE evalScript problem
Why not use Ajax#Updater for that, then you don't need to provide the onSuccess callback. http://prototypejs.org/api/ajax/updater new Ajax.Updater('register_form_gadget', url, {parameters:postParams}); -justin --~--~-~--~~~---~--~~ 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: How to dynamically send multiple forms in one Ajax.Request
Assuming you're not going to have naming collisions within your various forms, you could do something like this: var data; $$('form').each(function(form){ data += '&' + form.serialize(); }); In this usage, you do not want to pass the getHash parameter as true. -justin --~--~-~--~~~---~--~~ 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.observer oncontextmenu
You need to attach it to the window object, not the document.body object. Event.observe(window, 'contextmenu', someMethod); -justin --~--~-~--~~~---~--~~ 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.observer oncontextmenu
On Thu, Oct 2, 2008 at 12:47 PM, kangax <[EMAIL PROTECTED]> wrote: > It could, if you are using an older version. Latest one doesn't check > against a list of event names, so observing an event on document.body > should work. Yes it does. I thought it was only a window event but sure enough it works fine on the body as well. -justin --~--~-~--~~~---~--~~ 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: Autocompleter doesn't cancel pending requests
That's a good idea. I prefer to leave the prototype and scriptaculous source files in pristine condition whenever possible so that when I update to a newer version I don't have to keep track of what I changed and having to reapply those changes. So here is the same idea, but extending Ajax.Autocompleter instead of altering the code directly. This code would go in a separate file that is included after controls.js is included. http://pastie.org/284326 -justin --~--~-~--~~~---~--~~ 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] Chicago JavaScript Meetup
Excuse 'spamming' the forum, but it's relevant Vlad Didenko is organizing Chicago's first JavaScript meetup. If you are in the Chicago area and looking to improve your JavaScript skills, join the group at http://javascript.meetup.com/10/. We are posting discussion/talk topics to http://tinyurl.com/jsca081017. Of course, Prototype will be featured. Thanks, Justin Meyer --~--~-~--~~~---~--~~ 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: Observing the removal of elements
You can use Function#wrap to help you with this by wrapping the Element#remove method, but you will also have to watch out for other destructive methods on elements such as Element#update and Element#replace. http://prototypejs.org/api/function/wrap -justin --~--~-~--~~~---~--~~ 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: How can I get input elements of a div in order of their position?
Have you looked into the Form helper methods such as Form#getElements? http://prototypejs.org/api/form/getElements -justin --~--~-~--~~~---~--~~ 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: How can I get input elements of a div in order of their position?
2008/10/6 buda <[EMAIL PROTECTED]>: > > it is - but on a form it may be several divs filled with input > elements and I have to work with them separetely from other divs and I > need to have their right ordered array of input elements You're right, sorry I did not think of that. Rob's idea is a good one. You could also still use the Form#getElements method then filter out those that are not in the div your interested in. What route your choose should dependent on your markup mostly (lots of form controls vs. lots of div child elements). -justin --~--~-~--~~~---~--~~ 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: How can I get input elements of a div in order of their position?
2008/10/6 buda <[EMAIL PROTECTED]>: > > Thanks for idea, there is no any way by doing it with prototype.js > nativly? Correct, it would require chaining something like Enumerable#select or something else. $('form-id').getElements().select(function(element){ return element.up('div#your-div-id'); }); -justin p.s. look I did not use 'your' improperly once! ;) --~--~-~--~~~---~--~~ 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: How can I get input elements of a div in order of their position?
2008/10/6 buda <[EMAIL PROTECTED]>: > it gets all elements for a form? but I need for a div! Usually wherever *form* elements (input, select, textarea) exist, a tag will be around them. --~--~-~--~~~---~--~~ 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: Ajax.Responders
Are you getting any errors? What browser are you using? I think that code can be cleaned up a bit, $() is expensive, it should be used sparingly. Also there is no need to call appear on an already visible element. Ajax.Responders.register({ onCreate: function(request){ var loading = $('loading'); if (loading){ loading.update('Loading (' + Ajax.activeRequestCount + ')') // only appear the element if it is not already visible if (!loading.visible()) loading.appear({duration:0.5}); } }, onComplete: function(request){ var loading = $('loading'); if (loading){ loading.update('Loading (' + Ajax.activeRequestCount + ')'); if (loading.visible() && Ajax.activeRequestCount < 1) loading.fade({duration:0.5}); } } }); --~--~-~--~~~---~--~~ 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: Getting Text Nodes of Elements
I think you will need to use the native methods to get the text nodes as Prototype filters them out. This will work though: $A( $('some-element-id').childNodes ).select( function(element){ return element.nodeType == 3; } ) Or better yet: Element.addMethods({ textNodes: function(element){ return $A(element.childNodes).select( function(child){ return child.nodeType == 3; } ); } }); Then you can just do: $('some-element-id').textNodes(); -justin --~--~-~--~~~---~--~~ 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: Ajax.Responders
Try in Firefox with Firebug, see if any errors show up. -justin --~--~-~--~~~---~--~~ 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: Ajax.Responders
On Tue, Oct 7, 2008 at 2:50 PM, Namotco <[EMAIL PROTECTED]> wrote: > > WebKit has a JS debugger much like Firebug, no errors. I know, but I still find Firebug to be much better about error reporting. > Here's the > function I call that seems to no decrement the counter: If there is an error in that code that causes the Ajax request to fail, it will not invoke the onComplete global callback. -justin --~--~-~--~~~---~--~~ 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: OT: console.log with Firefox and Internet Explorer
On Tue, Oct 7, 2008 at 3:29 PM, Miguel Beltran R. <[EMAIL PROTECTED]> wrote: > > //for detect if is installed Firebug or FirebugLite > if(!console){ > var console = { > log: function(a){} > }; > }; > I use the same technique and it works fine. Here is my exact code that works great in IE. // for debugging firebug style, in browsers that don't have firebug if (!console){ var console = { needsSetup:true, initialize: function(){ $(document.body).insert(''); console.logger = $('fake-firebug-console'); }, log: function(string){ if (!console.logger) return; // IE is funny about carriage returns in a textarea console.logger.insert(string + (Prototype.Browser.IE ? "" : "\n")); if (!console.logger.visible()) console.logger.show(); } }; } Then in a page load observer I do this: document.observe('dom:loaded', function(){ if (console.needsSetup) console.initialize(); }); Hope this helps. -justin --~--~-~--~~~---~--~~ 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: Form works in Opera & Firefox but not in IE and partially in Chrome & Safari
Can you create a simple page that displays this problem? It is very hard to debug/view your code on the live site. Also, at this point I consider Chrome a novelty but obviously you want things to work in IE and Safari might be a priority too. -justin --~--~-~--~~~---~--~~ 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: Form works in Opera & Firefox but not in IE and partially in Chrome & Safar
In Safari, when I change the first drop-down, the second and third drop-downs are updated but the second one remains disabled. Is that your intention or is that the bug you are describing? -justin --~--~-~--~~~---~--~~ 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: Form works in Opera & Firefox but not in IE and partially in Chrome & Safa
On Thu, Oct 9, 2008 at 3:02 AM, Mondane <[EMAIL PROTECTED]> wrote: > The bug in Safari is, when choosing an option > in the third drop-down (Choose your category), the form resets to only > showing "Choose your game". After this, it stops working. I didn't have that problem, was able to get through all the way so that it showed the quick solution below the form. Is it maybe dependent on the options you choose? Since you are using a GET request, you should escape your parameters to ensure the value chosen is what is received by the server. Wrt to IE, it sounds like you've got a JavaScript error that is causing the Ajax request to not submit. Do you have Script Debugger installed in IE? If not, you should install it and then go into the advanced options for IE and enable script debugging. -justin p.s. I loved that game lemmings, forgot all about 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-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: Form works in Opera & Firefox but not in IE and partially in Chrome & Saf
On Thu, Oct 9, 2008 at 11:42 AM, Mondane <[EMAIL PROTECTED]> wrote: > @Justin: I don't have script debugger. Going to look for it tomorrow. > Weird btw @ Safari, what version are you using, mine is is the windows > one. > > What do you mean by escaping the parameters? I am using Safari on Mac. Escaping parameters like this: escape('some string, with special $tuff in it% &') -justin --~--~-~--~~~---~--~~ 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: location.hash and event handler/window event
I know of no native way to do this. The first thing that comes to mind is using window.setInterval() to invoke a function every couple of seconds to see if the address bar has been changed. Are you updating the address bar when an Ajax request changes the page, but then when you click the back button you are noticing that the URL changes (after the hash symbol) but nothing else does? -justin --~--~-~--~~~---~--~~ 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: location.hash and event handler/window event
On Thu, Oct 9, 2008 at 12:03 PM, Mauro Marchiori Neto <[EMAIL PROTECTED]> wrote: > setInterval right? wouldnt it overload the browser? Not necessarily, as long as your URL checking function is simple and you don't check very frequently. Say, something like this: var AnchorChecker = { initialize: function(){ this.location = location.href; this.interval = setInterval(function(){ if (this.location != location.href) this.anchorAltered(); }.bind(this), 500); // check every half second }, anchorAltered: function(){ // the url has been altered } }; AnchorChecker.initialize(); ^ 100% untested, beware -justin --~--~-~--~~~---~--~~ 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: location.hash and event handler/window event
On Thu, Oct 9, 2008 at 1:56 PM, Mauro Marchiori Neto <[EMAIL PROTECTED]> wrote: > This works flawlessly! Yes I think I forgot the most important line, glad you got it working :) -justin --~--~-~--~~~---~--~~ 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: Getting Text Nodes of Elements
On Thu, Oct 9, 2008 at 10:42 PM, RobG <[EMAIL PROTECTED]> wrote: > Interesting, but it relies on browser sniffing and proprietary > properties. What's wrong with that? If it is in the name of performance, I say go for it. -justin --~--~-~--~~~---~--~~ 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: Getting Text Nodes of Elements
On Sat, Oct 11, 2008 at 10:31 AM, RobG <[EMAIL PROTECTED]> wrote: > Performance is not the issue - fewer lines of code doesn't necessarily > mean faster performance. Do you differentiate between browser sniffing and object/method sniffing? Do you like that Prototype's Selector#findElements method uses XPATH (Firefox) and querySelector/querySelectorAll (WebKit) when available? Or do you think this muddles up the codebase with unnecessary branching? (not trying to get into a huge discussion, just curious where you draw the line) -justin --~--~-~--~~~---~--~~ 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: One AJAX Script, Three Browser Bugs?
There is no inherit flaws in Prototype that would cause erratic behavior like you are describing. That's just plain ludicrous for somebody to suggest that, typical jQuery crowd trying to pimp their framework at any chance they can ;) Right away I think your initializer code is buggy. Not sure why you're iterating over the entire forms collection and then using a regex to match an ID. Your form has an ID so why not use it? Or if you will have multiple forms to observe why not just give them all a class name then you can match just those forms by doing: ... $$("form.poll").each(...) Also, you should use a true event observer rather than the onsubmit attribute, such as: someFormElement.observe('submit', function(event){ event.stop(); /* stop the form from being submitted */ }); Also, you are assigning a function to onsubmit, but that function is lacking the proper scope. I don't see how the code you have would work in any browser but I guess I'm missing something since you say it works in IE. Why don't you try something more like this: var PollForm = { initialize: function(){ // for each element that matches this selector, invoke the // observe method with these arguments $$('form.poll').invoke('observe', 'submit', this.formSubmit.bindAsEventListener(this)); }, formSubmit: function(event){ // stop the form from being submitted event.stop(); // process the form passing in the form relating to the event this.processForm(event.element()); }, processForm: function(form){ // do whatever you need to do here var formData = form.serialize(); } } document.observe('dom:loaded', PollForm.initialize.bind(PollForm)); See these pages for more info on the various methods used in this example: http://www.prototypejs.org/api/document/observe http://www.prototypejs.org/api/utility/dollar-dollar http://www.prototypejs.org/api/enumerable/invoke http://www.prototypejs.org/api/event/observe http://www.prototypejs.org/api/form/serialize Hope this helps. -justin --~--~-~--~~~---~--~~ 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: Adding onkeypress attribute at run time
Why aren't you using any of the Prototype code for finding elements and attaching event observers? $$('input[type=text]).each(function(input){ input.observe('keypress', function(event){ alert('key press!'); }); }); // or cleaner... $$('input[type=text]).invoke('observe', 'keypress', function(event){ alert('key 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: "Prototype.js (1.6.0.3) breaks Firebug (1.2.1) Options" allegedly.
Ever since Firefox3, there have been many issues with Firebug and I find it pretty hard to believe that Prototype is the cause of these issues. There didn't seem to be anything wrong with running Firebug and Prototype side-by-side on Firefox2. Guess it's easier to blame than to fix. What specific issues are you having? -justin --~--~-~--~~~---~--~~ 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: "Safe" hiding of a DOM element
On Thu, Oct 16, 2008 at 10:34 AM, Eric <[EMAIL PROTECTED]> wrote: > Wouldn't it be more convenient if the syntactic-sugar-free version of > Element's methods were "null-proof safe" No, that would encourage incredibly bad practices and also make tracking down errors with non-existent elements quite difficult to track down. If you want to do it with a one-liner, invoke is null-safe: $$('#pleaseWait').invoke('hide'); -justin --~--~-~--~~~---~--~~ 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: Demos?
All that stuff has been moved to the github wiki for Scriptaculous: http://github.com/madrobby/scriptaculous/wikis All the scriptaculous links at script.aculo.us point over to the wiki but I did notice that the "animation framework" link points to an invalid page at github, which probably made you think the demos were down. -justin --~--~-~--~~~---~--~~ 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: Demos?
I agree github is a little tough to use if you're just looking for demos. There has been a lot of talk about setting up an easier to use wiki, but the details are still being worked out iirc. In the meantime the wiki on github is the best option. Which effect are you wanting to loop? -justin --~--~-~--~~~---~--~~ 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: I use Updater with a webpage in different folder. I can't see images
Why don't you use paths to your images that are relative to the webroot instead of the directory they are in so that they work no matter where they are? The convention is to have a directory in your webroot called "images" and all your imagery goes in there. /images/c1/foo.jpg /images/c2/bar.jpg -justin --~--~-~--~~~---~--~~ 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: PeriodicalExecuter vs. Ajax.PeriodicalUpdater: use cases and advice?
Why aren't you just using the Ajax.PeriodicalUpdater, which supports the decay option? var poller = new Ajax.PeriodicalUpdater('some-element-id', '/foo/bar', {decay:10}); Also, if you pass an empty string as the first parameter, then you can pass pure JavaScript to be executed as opposed to just replacing the contents of a page element. -justin --~--~-~--~~~---~--~~ 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: PeriodicalExecuter vs. Ajax.PeriodicalUpdater: use cases and advice?
Well since the Ajax requests in Prototype will auto-eval the response, you can modify the page without updating just one div. It's the route I take most of the time. Say you set it up like this: new Ajax.PeriodicalUpdater('', '/some/url'); Then the response from /some/url could be: $('some-element').blindUp({duration:0.5); // wait for the blind up to complete before replacing the content Element.update.delay(0.5, 'some-element', 'my new content'); // wait for the blind up to complete, then wait a 10th of a second longer Element.blindDown.delay(0.6, 'some-element', {duration:0.5}); You get the idea. I find it more flexible and convenient than updating just a single element. You could alternatively call into some predefined object/method to do this work. Some people might be opposed to this approach, but it works. -justin --~--~-~--~~~---~--~~ 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: how to optimize?
> Is there a way to write in one-line instruction on prototype? $$('#elid').invoke('doSomething'); --~--~-~--~~~---~--~~ 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: PeriodicalExecuter vs. Ajax.PeriodicalUpdater: use cases and advice?
Hey man, you wanted an example and you got it. I gave you an example of a typical Rails RJS response, which are auto-generated from ruby-like code rather than written to leverage a particular framework's callbacks, etc. -justin --~--~-~--~~~---~--~~ 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: get all values?
On Tue, Oct 28, 2008 at 1:58 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > i have many divs with the same id . An element ID MUST be unique for the whole page. Use a class instead, then use the $$() method to fetch them all. -justin --~--~-~--~~~---~--~~ 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: get all values?
given this: do this: $$('div.foo').each(function(div){ alert(div); }); The each method is an *iterator*. http://prototypejs.org/api/enumerable/each -justin --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---