Re: [Proto-Scripty] Re: Passing the content of an array in a form
Le mardi 22 décembre 2009 05:11, joe t. a écrit : For most typical cases, JSON is easier, and more efficient. For one, by sending a Content-type header of application/json you can send an array down from the server, and Prototype automatically converts it into a JSON object you can utilize. I'm switching to json, and you're right, it is much easier to handle! -- Frédéric -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Re: Prototype and IE
Hi, i get the problem, it was a span with some attributes that was inserted in a hiperlink the code that generated the non-show elementos on links was: a onclick='site.linkClick(/, home); return false;' href=# class=link-homespan style=display: block; visibility: hidden;//a the span block that caused the problem in IE. Thanks for the insights. 2009/12/21 T.J. Crowder t...@crowdersoftware.com Hi, I'm afraid there's nothing much to do other than step through it in a debugger (yes, there _are_ debuggers for IE, the script debugger[1] and Visual Studio) and figure out at what point it's breaking. If you can figure out where it's breaking and post that, we may be able to help. [1] http://www.microsoft.com/downloads/details.aspx?familyid=2f465be0-94fd-4569-b3c4-dffdf19ccd99displaylang=en Sorry not to have a better idea for you... -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 21, 5:00 pm, Glauber Portella glauberporte...@gmail.com wrote: I updated my prototype and scriptaculous version and the problem didnt go away. I removed the history manager too to see if was a problem with it but it wasn't. Please help me! 2009/12/21 Glauber Portella glauberporte...@gmail.com Nothing changed when i rewrite to not replace protoype in Class.create. Any other sugestion to try ?? Thanks 2009/12/21 Glauber Portella glauberporte...@gmail.com Hi T.J. Crowder ajax-content is the only ID for the content element. I am working with Prototype Version: 1.6.0.3 i will read and alter to the proper usage of Class.create. Ps.: ProtoHistoryManager is from one extension that i get in http://scripteka.com/(Prototype.HistoryManager)http://scripteka.com/%28Prototype.HistoryManager%29 Thanks 2009/12/21 T.J. Crowder t...@crowdersoftware.com Hi, I can't address the ProtoHistoryManager stuff, never seen that. But the `getPage` call looks fine. IE has issues with confusing IDs and names; do you have *anything* else on your page with the ID _or_ name ajax-content? [Possibly OT] What version of Prototype are you using? Because your Class.create call doesn't look like it's for the current version of Prototype (1.6.1). Since 1.6.0, you shouldn't replace the prototype on a class you've created with 1.6.x's Class.create. More: http://api.prototypejs.org/language/class.html] HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 21, 10:12 am, glauber portella glauberporte...@gmail.com wrote: Hello, i am using ajax from prototype and some effects with scriptaculous and i am getting a strange behaviour when it is to be executed in Internet Explorer, my code use prototype history manager and for some reason my contents isn't show in IE, the core of the javascript is listed below: var site = null; var Chiquinho = Class.create(); Chiquinho.prototype = { initialize : function(links) { this.justloaded = true; this.currentLink = undefined; this.links = links; this.contentEl = $('ajax-content'); this.site_urls = { home : '/', empresa : '/empresa', artista : '/artista', agenda : '/agenda', locacao : '/locacao', contrate : '/contrate', depoimento : '/depoimento', parceiro : '/parceiro', contato : '/contato', artista1 : '/artista/show/id/1', artista2 : '/artista/show/id/2', artista3 : '/artista/show/id/3', artista4 : '/artista/show/id/4', artista5 : '/artista/show/id/5', artista6 : '/artista/show/id/6', artista7 : '/artista/show/id/7', artista8 : '/artista/show/id/8', artista9 : '/artista/show/id/9', artista10 : '/artista/show/id/10', artista11 : '/artista/show/id/11', artista12 : '/artista/show/id/12', artista13 : '/artista/show/id/13', artista14 : '/artista/show/id/14', artista15 : '/artista/show/id/15', artista16 : '/artista/show/id/16',
[Proto-Scripty] Re: Ajax.Request
I wrestled with asynchronous calls like you have (and quite honestly, found the structure associated with the onSuccess/onFailure lead to confusing code) I eventually settled on using var myAjax = new Ajax.Updater( target, url, {method: 'post', parameters: pars, evalScripts: true} ); (AFAIK, 'evalScripts: true' does not seem to work with Ajax.Request... someone please corrected me if I'm wrong) I then code within the url to generate the scripts that should be spawned on success or failure (and I can set things so that the scripts don't get called until all of the prerequisite bits are available). Depending on the nature of the calls/results, I occasionally set the target to a hidden div. Once I settled on this approach, I had carefully (re-)structure my code so that calls cascaded properly... i.e., I found that on occasion, the same functions were getting spawned from differenturl's (meaning that the pages could regenerating things unnecessarily). Hope this helps, Al On Dec 20, 6:35 am, kangur91 kangu...@gmail.com wrote: My code: function get_data_default() { new Ajax.Request('/adress', { method:'post', asynchronous:true, onSuccess: function(data){ return data.responseText.evalJSON (true); }, onFailure: function(){ alert('Something went wrong...') } });} } function show(){alert(get_data_default());} I want to function get_data_default return data recived from OnSucces function. How do that? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Re: Ajax.Request
If i recall correctly ... Failure only gets called on a server error ... like a 404 ... The failure may be due to a javascript error and would not return the alert if that was the case. On the back success only calls when the server has responded... Ergo there are many things that can go wrong - i've listed a couple below 1. Transit. To/From the server 2. Server side scripts (will return whitespace upon an error - if error reporting is turned off) and this is still considered a success by javascript. Also i noticed in the original post that you had asynchronous: true... It is true by default so you can save a few bites there. As TJ said in an earlier reply, You cannot return out of the Ajax request as it is run asyncronously with the page (meaning [in easy terms] you can execute alot of javascript at the same time as the request without locking the browser]). To perform what you want to achieve (if i'm getting what you want to do correctly) you should create a response handler ... something akin to onSuccess : function(data) { myHandler({data:data.responseText.evalJSON,vars:someotherVars}); } ... function myHandler(options) { var ReposnseData=options.data; $('someElement').update(ResponseData); } Hope this helps... Alex Mcauley http://www.thevacancymarket.com - Original Message - From: Al C al.caug...@gmail.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Tuesday, December 22, 2009 2:29 PM Subject: [Proto-Scripty] Re: Ajax.Request I wrestled with asynchronous calls like you have (and quite honestly, found the structure associated with the onSuccess/onFailure lead to confusing code) I eventually settled on using var myAjax = new Ajax.Updater( target, url, {method: 'post', parameters: pars, evalScripts: true} ); (AFAIK, 'evalScripts: true' does not seem to work with Ajax.Request... someone please corrected me if I'm wrong) I then code within the url to generate the scripts that should be spawned on success or failure (and I can set things so that the scripts don't get called until all of the prerequisite bits are available). Depending on the nature of the calls/results, I occasionally set the target to a hidden div. Once I settled on this approach, I had carefully (re-)structure my code so that calls cascaded properly... i.e., I found that on occasion, the same functions were getting spawned from differenturl's (meaning that the pages could regenerating things unnecessarily). Hope this helps, Al On Dec 20, 6:35 am, kangur91 kangu...@gmail.com wrote: My code: function get_data_default() { new Ajax.Request('/adress', { method:'post', asynchronous:true, onSuccess: function(data){ return data.responseText.evalJSON (true); }, onFailure: function(){ alert('Something went wrong...') } });} } function show(){alert(get_data_default());} I want to function get_data_default return data recived from OnSucces function. How do that? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Re: Ajax.Request
An alternative i sometimes use is to set a timeout on a function to check within a period of time - usually a hidden input with the time of the request - checking it until its complete That way i can know if anyting failed in the request and send it again if it did ... each to their own ! Alex Mcauley http://www.thevacancymarket.com - Original Message - From: Walter Lee Davis wa...@wdstudio.com To: prototype-scriptaculous@googlegroups.com Sent: Tuesday, December 22, 2009 3:54 PM Subject: Re: [Proto-Scripty] Re: Ajax.Request This is an important thing to work on. If I know I will be using onError on the client side, I make sure that my Ajax endpoint on the server will return a real error header using PHP's header() method. You can also get very fancy with different error header codes, too, throwing a distinctly different error depending on the nature of that error, and then handling it in the Ajax callback using one of the onNNN methods instead of onError (which covers any error between 400 and 5NN, IIRC). Walter On Dec 22, 2009, at 10:21 AM, Alex McAuley wrote: 2. Server side scripts (will return whitespace upon an error - if error reporting is turned off) and this is still considered a success by javascript. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: self-or-ancestor in one whack?
You could use a closure to ensure you're dealing with the right element. $$('.my_table td').each(function(cell){ cell.observe('mouseover', listener.curry(cell)); }); function listener(cell, evt){ if(evt.element() != cell) return false; } Are you trying to have a clean way to avoid flickering? -- http://positionabsolute.net On Dec 19, 7:00 pm, Tobie Langel tobie.lan...@gmail.com wrote: var elm = evt.findElement('td'); is exactly the same as doing: var elm = evt.element(); if(elm.tagName.toString().toLowerCase() != 'td') elm = elm.up ('td'); Only it'll accept any kind of CSS selector. On Dec 19, 3:38 pm, Walter Lee Davis wa...@wdstudio.com wrote: I'll give that a try. I'm not sure (from the API docs) if that's going to do exactly what I want or not. Thanks, Walter On Dec 19, 2009, at 9:23 AM, ColinFine wrote: On Dec 18, 5:51 pm, Walter Lee Davis wa...@wdstudio.com wrote: I use this construction quite a lot: var elm = evt.element(); if(elm.tagName.toString().toLowerCase() != 'td') elm = elm.up('td'); whenever I am constructing a rollover listener, since it works around the whole issue with mouseover / out events firing whenever you move over a child of the element you're trying to observe. Is there a simpler way to do this, a more Prototype-y way, that is? I've had a look around the API, and I also had a Google, but the former didn't turn up anything useful and the latter turned up every commit message from every project that includes Prototype. I belive that is what Element.findElement is for. Colin -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . For more options, visit this group athttp://groups.google.com/group/prototype-scriptaculous?hl=en . -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Re: self-or-ancestor in one whack?
On Dec 22, 2009, at 12:41 PM, Matt Foster wrote: You could use a closure to ensure you're dealing with the right element. $$('.my_table td').each(function(cell){ cell.observe('mouseover', listener.curry(cell)); }); function listener(cell, evt){ if(evt.element() != cell) return false; } Are you trying to have a clean way to avoid flickering? Sort of, really just trying to make sure that mouseover events triggered by child elements are credited to the parent. I tried Tobie's technique, and it works perfectly. My long-hand method worked fine as well -- no flickering I could discern -- so it's really just a coding elegance refinement I was going for rather than anything else. I am using event delegation -- observing the entire table once rather than each cell -- so maybe that's why I wasn't seeing any flicker. Walter -- http://positionabsolute.net On Dec 19, 7:00 pm, Tobie Langel tobie.lan...@gmail.com wrote: var elm = evt.findElement('td'); is exactly the same as doing: var elm = evt.element(); if(elm.tagName.toString().toLowerCase() != 'td') elm = elm.up ('td'); Only it'll accept any kind of CSS selector. On Dec 19, 3:38 pm, Walter Lee Davis wa...@wdstudio.com wrote: I'll give that a try. I'm not sure (from the API docs) if that's going to do exactly what I want or not. Thanks, Walter On Dec 19, 2009, at 9:23 AM, ColinFine wrote: On Dec 18, 5:51 pm, Walter Lee Davis wa...@wdstudio.com wrote: I use this construction quite a lot: var elm = evt.element(); if(elm.tagName.toString().toLowerCase() != 'td') elm = elm.up('td'); whenever I am constructing a rollover listener, since it works around the whole issue with mouseover / out events firing whenever you move over a child of the element you're trying to observe. Is there a simpler way to do this, a more Prototype-y way, that is? I've had a look around the API, and I also had a Google, but the former didn't turn up anything useful and the latter turned up every commit message from every project that includes Prototype. I belive that is what Element.findElement is for. Colin -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . For more options, visit this group athttp://groups.google.com/group/prototype-scriptaculous?hl=en . -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en . -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: instantiate class problem on IE
Hi Loris, I think that your trouble is normal, because IE don't allow to instantiate method on native object. Generally it's not a good idea to extend native objects because your not sure that another JS will not use the same method name !! -- david On 19 déc, 00:36, Loris loris.men...@gmail.com wrote: hello, sorry for my bad English. I try to explain: I try to instantiate a class when the page loads, but when I happened on most browsers, I can not do it in Internet Explorer 7 or 6 I call the script in my template, like this: script type=text/javascript src=/js/veicoli-random.class.js/ script script type=text/javascript new VeicoliRandom('wrap-cont_veicoli_random', 'cont_veicoli_random', '{$url_pagina}'); /script And the script contains: Random = Class.create(); Random.prototype = { wrap : null, nomeWrap : null, container : null, nomeContainer : null, url : null, initialize : function(wrap, container, url) { this.wrap = $(wrap); this.nomeWrap = wrap; this.container = $(container); this.nomeContainer = container; this.url = url; if ( this.url == '' ) this.url = '/'; if (!this.container || !this.wrap) return; this.arrotola.bind(this).delay(10); }, arrotola : function() { // nascondo la scritta sold, per IE var ElementiNIE = $$('#' + this.nomeContainer + ' div.timbro-venduto- random'); ElementiNIE.each( function(div) { div.addClassName('invisibileIE'); }); // arrotolo su Effect.BlindUp(this.wrap, { duration: 3 }); this.aggiorna.bind(this).delay(5); }, aggiorna : function () { // aggiorno var options = {onComplete : this.srotola.bind(this).delay(1)}; new Ajax.Updater(this.container, this.url, options); }, srotola : function() { this.wrap.setStyle({ display: 'none' }); // srotolo giù Effect.BlindDown(this.wrap, { duration: 3 }); this.arrotola.bind(this).delay(15); }, }; Object.extend(document, { isDocReady: false, isDocLoaded: false, ready: function(fn) { Event.observe(document, doc:ready, fn); }, load: function(fn) { Event.observe(document, doc:loaded, fn); }}); Event.observe(document, dom:loaded, function() { Event.fire(document, doc:ready); document.isDocReady = true; if (document.isDocLoaded) Event.fire(document, doc:loaded);}); Event.observe(window, load, function() { document.isDocLoaded = true; if (!document.isDocReady) return; Event.fire(document, doc:loaded); }); // fa partire la vera classe al load della pagina VeicoliRandom = Class.create(); VeicoliRandom.prototype = { initialize : function(wrap, container, url) { // Event.observe(window, 'load', new Random(wrap, container, url)); //document.observe('dom:loaded', new Random(wrap, container, url)); document.load( a = new Random(wrap, container, url) ); }, }; I can not understand why the class called random is not instantiated or otherwise IE does nothing. While with fire-fox or other browsers, seems to work properly. What could be my mistake? Thank you for your attention. Regards Loris -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: BlindDown/Up rendering wrong
Hi Lenni, Do you have any code whe can play with ?? the HTML used and CSS applyied on HTML element :)) -- david On 21 déc, 15:01, Lenni leonard.ehrenfr...@web.de wrote: Hi, I'm trying to use the BlindDown/Up effect but it it renders stuttery and weird on all the major (FF 3.5, IE 8, Chrome 4) Browsers. Basically, the background div that is is referenced in the function call, doesn't extend all the way down. It's contents are shown fine. Also, it works fine for the first time, but every susequent BlindDown is borked. Screenshot:http://www.flickr.com/photos/24003...@n00/4203465158/sizes/o/ My suspicion is that there is some stray CSS that the effect doesn't aggree with, but I played around with it in Firebug but couldn't get to the bottom of it. I did make one observation though: Whenever I roll the div up, even in the hidden state it still has a height CSS attribute with a value of something like 80px. If I manually remove the attribute the BlindDown looks as intended. Anybody care to enlighten me as to what I'm doing wrong? -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Pulse effect sometimes stopping on darkened version
I am using pulse effects in my app to highlight UI components on mouseover of some help text. Sometimes, however, the animation gets stuck or something and you are stuck with a greyed out DIV. Any ideas on what I may be doing wrong or how I may work around it? http://placebook.tv - hover the links in the instructions panel on the left repeatedly. cheers -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.