[Proto-Scripty] Re: Ajax.Updater home-brew autocompletion timing issue
Jonny .. i wrote this a few months back and forgot about it ... Its the basics you will need to achieve what you want to do Any questions please ask http://proto-scripty.wikidot.com/prototype:how-to-throttle-ajax-requests Regards Alex - Original Message - From: "Alex Mcauley" To: Sent: Sunday, March 01, 2009 7:21 PM Subject: [Proto-Scripty] Re: Ajax.Updater home-brew autocompletion timing issue > > there is a completely easier way to do what you want and save memory on > the > client side and serverside ... > > If you can wait till monday i will post the code for you to do it > > > Regards > Alex > > - Original Message - > From: "Jonny Nott" > To: "Prototype & script.aculo.us" > > Sent: Saturday, February 28, 2009 12:12 PM > Subject: [Proto-Scripty] Ajax.Updater home-brew autocompletion timing > issue > > >> >> I use the following Ajax.Updater code to auto-complete (refresh) the >> options within a select box according to text entered into an input >> [type=text]. >> >> The code is part of a function which is envoke by the 'onkeyup' event >> on the input: >> >> new Ajax.Updater(targetSelect.identify(), xhrRequestUrl, { >> method: 'get', >> parameters: { >> match: inputControl.getValue() >> }, >> onCreate: targetSelect.disable.bind(targetSelect), >> onSuccess: (function(){ >> targetSelect.enable(); >> }).bind(targetSelect) >> }); >> >> The problem: with large data sets, the ajax requests take long time to >> process on the server, and then there's network lag, etc. This returns >> in (sometimes) the responses come back in the wrong order. An example: >> >> - user types 'abc', which sets off 3 requests, with 'match' param of >> 'a', 'ab', 'abc' respectively. >> - due to server delay/network lag etc, sometimes the response for >> 'abc' comes back *before* the 'ab' response >> - select box ends up containing all entries match 'ab', rather than >> only those matching 'abc' >> >> The solution I've thought of: >> >> Somehow make a callback function which short-circuits (i.e. aborts) >> the Ajax.updater object if it's 'match' parameter is different from >> the current value of 'inputControl' at the point where it's about to >> empty and replenish the select box with the HTML from the response. >> Issues: >> >> - Which callback will allow me to intercept Ajax.updater at this >> point? Will this even work with Ajax.updater, or do I need to use >> Ajax.request and update the contents of the select box element >> manually if the condition for doing so are met? >> - How can a callback access the 'parameters' which were set for the >> request? Can it even? Will I need to duplicate 'match' into some local >> variable - and even then how will the anonymous callback function get >> at it? >> >> Am I barking up the wrong tree altogether? >> >> Jon >> >> > >> > > > > > --~--~-~--~~~---~--~~ 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] Password field as hint
Hey all, I'm using a handy function written by Thomas Fuchs for using an input field as a hint. The problem is, I want to use a password field as a hint also. I tried doing things like $('password').type = 'text', things like that to change the type on the fly, but IE doesn't support this. I then tried cloning the node and replacing it, but this loses the binding of the element to the function (it is no longer "observed" by focus or blur). Does anyone have an idea or experience doing this? Here is the code as I have it, but it's getting a bit convoluted and doesn't work 100%. Thanks... (function() { var methods = { defaultValueActsAsHint: function( element ) { element = $(element); element._default = element.value; //element._type = element.type; if( element.type == 'password' ) { var e = element.cloneNode(true); e.type = 'text'; Element.replace(element,e); e.defaultValueAsHint(); e._type = 'password'; } return element.observe('focus', function() { if(element._default != element.value) return; console.log(element.type); if( element._type == 'password' ) { var e = element.cloneNode(true); e.type = 'password'; Element.replace(element,e); element = e; e._type = 'text'; e.focus(); e.defaultValueAsHint() } element.removeClassName('hint').clear(); }).observe('blur', function() { console.log(element.type); if(element.value.strip() != '') return; if( element.type == 'password' ) { var e = element.cloneNode(true); e.type = 'text'; Element.replace(element,e); e.defaultValueAsHint(); e._type = 'password'; } element.addClassName('hint').value = element._default; }).addClassName('hint'); } }; $w('input textarea').each(function(tag){ Element.addMethods(tag, methods) }); })(); --~--~-~--~~~---~--~~ 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: Password field as hint
Hi, I had the same problem yesterday. Basic simple working example is here: http://dl.getdropbox.com/u/530105/input.html. Just check it - all in one file. Script which I've created last night which is working on all input fields on a page is here http://pastie.org/404519. It is really messy but it works. You have it also here http://dl.getdropbox.com/u/530105/inputfields.js. Just include it in your code, check if you have prototype included and it will replace all things like : Username I'll post something more when I make it look nicer. I hope this give you some hint :) Quleczka p.s. it is based on http://www.folksonomy.org/2009/01/12/changing-input-type-from-text-to-password-in-internet-explorer-hack/ --~--~-~--~~~---~--~~ 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: Password field as hint
Uppps, second script is not working in IE. Forget about it. Simple solution for one password field you still have here http://dl.getdropbox.com/u/530105/input.html. You can also change it to add mockpassword input dynamicly in your script. "I then tried cloning the node and replacing it, but this loses the binding of the element to the function (it is no longer "observed" by focus or blur). " You have to observe focus only from this newly created element - not orginal password field... and observe blur only on orginal one, not mocked one. I'll work on this script later on :) Quleczka --~--~-~--~~~---~--~~ 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: Password field as hint
Version with second field added in script http://dl.getdropbox.com/u/530105/input2.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 prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] clonePosition - problem in IE and Opera
This code works in firefox 2, firefox3 and chrome but in in opera, ie6, ie7 olive div appear in wrong place when u scroll list. In ie it goes up and in opera down. Why, any solution?. ul{margin: 200px 0px;padding: 0px;list-style: none;background-color: blue;overflow: auto;width:120px;height: 150px;} li{width:100px;height: 100px;background-color: green;} #klon{position:absolute;width:100px;height: 100px;z-index: 10;background-color: olive; } a b n m t u o http://ajax.googleapis.com/ajax/ libs/prototype/1.6.0.3/prototype.js" > http://ajax.googleapis.com/ajax/ libs/scriptaculous/1.8.1/scriptaculous.js" > Event.observe(window, 'load', function() { var klon; $$('li').each(function(el){ Event.observe(el, 'mouseover', function(event) { klon = $('klon'); klon.clonePosition(el); klon.show(); klon.clonePosition(el); }); }); Event.observe('klon', 'mouseout', function(event) { klon.hide(); }); }); --~--~-~--~~~---~--~~ 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: Password field as hint
Ok, I've fixed a script so it is working now for IE as well :) Changing all fields in the form example: http://dl.getdropbox.com/u/530105/registerform.html and script is here http://dl.getdropbox.com/u/530105/inputfields.js Still is really messy, I don't have time right now to make it nicer :) Quleczka --~--~-~--~~~---~--~~ 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] How to correct the following code?
My code is to preview webpages when user move mouse over . At the same time, my code has other parts using Prototype periodicalupdater. The following code can work well independently: // javascript preview program start var ci; var xPos,yPos; Event.observe(window,'load',function(){ var elms = document.getElementsByClassName("toplink"); Event.observe(elms[0],'mouseover',function(ev){gotopreview(ev, 0);}); Event.observe(elms[1],'mouseover',function(ev){gotopreview(ev,1);}); Event.observe(elms[2],'mouseover',function(ev){gotopreview(ev,2);}); Event.observe(elms[3],'mouseover',function(ev){gotopreview(ev,3);}); }); function gotopreview(event,ci){ alert(ci); xPos = Event.pointerX(event); yPos = Event.pointerY(event); var getpostid=document.getElementsByName("targetpid"); var getsid = document.getElementsByName("stdid"); var url = "getOnePost.php"; var pars = "stdid="+getsid[ci].value + "&targetpid=" + getpostid [ci].value; var myajax = new Ajax.Request(url,{ method:'get', parameters: pars, asynchronous: true, onSuccess: function(transport){ $('previewWin').update(transport.responseText); $('previewWin').style.top = parseInt(yPos) + 2 + "px"; $('previewWin').style.left = parseInt(xPos) + 2 + "px"; $('previewWin').style.visibility = "visible"; $('previewWin').onmouseout =function(){ $ ('previewWin').style.visibility = "hidden";} } }); } // javascript preview program end // The above code can work well independently. And my html page is link: XXX XXX XXX XXX But when it comes to work with the periodical updater, it seems that periodicalupdater send request first, breaking down the preview code setting new Ajax.Request. And the object is no longer refering to the gotopreview function. The following is my periodical code, obj = new Object(); obj.f1 = eventHandler; window.onload = obj.f1; window.onunload = function(){}; function eventHandler(){ postUpdater(); } function postUpdater() { var myAjax = new Ajax.PeriodicalUpdater( "recentPost", "recentPost.php", { method: 'get', frequency: 50 }); } I use firebug to check the program and found that before I move mouse over the "toplink" anchor, the postUpdater() function will send request to the Sever thus, my preview code is no longer work. I know that there is bind and bindAsListener function to bind the gotopreview function. I tried but it's not work also, could some one help me or tell me how to modify the code to make it work? Is there any way stop the periodicalUpdater when it is loaded? Or if I must to use bind or bindAsListener, how to write it correctly in the above code? Any help would be appreciated! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] User triggered download with no page refresh.
Hi. I'm currently using an iframe to act as a report downloader. The user enters some criteria which is generated dynamically as they change options. They then click a document button (PDF, XLS, DOC) and this is sent to the server for validation. The result is a key for the Crystal Reports. The JS code generates an iframe and passes the key as part of the URL. As the key is a hash, and has to be part of the user's session, security is quite high. Guessing keys is useless unless there is corresponding data already submitted for the key. On screen, I dim the form for ajax requests and fade in a spinner. So far so good. My problem is that once I've created the iframe I've no way of knowing about the state of the iframe - has it loaded and presented the user with the appropriate download box. Are there any events I can observe with regard to an iframe (ie7, FF, Chrome - intranet only and so can be limited in support). I suppose as a side question, how do I find what events are observable for any element? Is there a way? Or is it just a case of RTF HTML/JS M Regards, Richard Quadling. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~-~--~~~---~--~~ 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: User triggered download with no page refresh.
On page that iframe load u can put code: parent.name_of_some_js_function(); Works for me in all browsers. On 2 Mar, 14:21, Richard Quadling wrote: > Hi. > > I'm currently using an iframe to act as a report downloader. > > The user enters some criteria which is generated dynamically as they > change options. They then click a document button (PDF, XLS, DOC) and > this is sent to the server for validation. The result is a key for the > Crystal Reports. The JS code generates an iframe and passes the key as > part of the URL. As the key is a hash, and has to be part of the > user's session, security is quite high. Guessing keys is useless > unless there is corresponding data already submitted for the key. > > On screen, I dim the form for ajax requests and fade in a spinner. > > So far so good. > > My problem is that once I've created the iframe I've no way of knowing > about the state of the iframe - has it loaded and presented the user > with the appropriate download box. > > Are there any events I can observe with regard to an iframe (ie7, FF, > Chrome - intranet only and so can be limited in support). > > I suppose as a side question, how do I find what events are observable > for any element? Is there a way? Or is it just a case of RTF HTML/JS M > > Regards, > > Richard Quadling. > > -- > - > Richard Quadling > Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731 > "Standing on the shoulders of some very clever giants!" --~--~-~--~~~---~--~~ 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: User triggered download with no page refresh.
yes you can call from the iframe a function in the parent easily Or, you can read the iframe contents by traversing its DOM and looking for elements (inputs or things) just as easily as traversing the parent container HTH Alex - Original Message - From: "zero" To: "Prototype & script.aculo.us" Sent: Monday, March 02, 2009 1:36 PM Subject: [Proto-Scripty] Re: User triggered download with no page refresh. > > On page that iframe load u can put code: > > parent.name_of_some_js_function(); > > Works for me in all browsers. > > On 2 Mar, 14:21, Richard Quadling wrote: >> Hi. >> >> I'm currently using an iframe to act as a report downloader. >> >> The user enters some criteria which is generated dynamically as they >> change options. They then click a document button (PDF, XLS, DOC) and >> this is sent to the server for validation. The result is a key for the >> Crystal Reports. The JS code generates an iframe and passes the key as >> part of the URL. As the key is a hash, and has to be part of the >> user's session, security is quite high. Guessing keys is useless >> unless there is corresponding data already submitted for the key. >> >> On screen, I dim the form for ajax requests and fade in a spinner. >> >> So far so good. >> >> My problem is that once I've created the iframe I've no way of knowing >> about the state of the iframe - has it loaded and presented the user >> with the appropriate download box. >> >> Are there any events I can observe with regard to an iframe (ie7, FF, >> Chrome - intranet only and so can be limited in support). >> >> I suppose as a side question, how do I find what events are observable >> for any element? Is there a way? Or is it just a case of RTF HTML/JS M >> >> Regards, >> >> Richard Quadling. >> >> -- >> - >> Richard Quadling >> Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731 >> "Standing on the shoulders of some very clever giants!" > > > --~--~-~--~~~---~--~~ 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: User triggered download with no page refresh.
2009/3/2 zero : > > On page that iframe load u can put code: > > parent.name_of_some_js_function(); > > Works for me in all browsers. > > On 2 Mar, 14:21, Richard Quadling wrote: >> Hi. >> >> I'm currently using an iframe to act as a report downloader. >> >> The user enters some criteria which is generated dynamically as they >> change options. They then click a document button (PDF, XLS, DOC) and >> this is sent to the server for validation. The result is a key for the >> Crystal Reports. The JS code generates an iframe and passes the key as >> part of the URL. As the key is a hash, and has to be part of the >> user's session, security is quite high. Guessing keys is useless >> unless there is corresponding data already submitted for the key. >> >> On screen, I dim the form for ajax requests and fade in a spinner. >> >> So far so good. >> >> My problem is that once I've created the iframe I've no way of knowing >> about the state of the iframe - has it loaded and presented the user >> with the appropriate download box. >> >> Are there any events I can observe with regard to an iframe (ie7, FF, >> Chrome - intranet only and so can be limited in support). >> >> I suppose as a side question, how do I find what events are observable >> for any element? Is there a way? Or is it just a case of RTF HTML/JS M >> >> Regards, >> >> Richard Quadling. >> >> -- >> - >> Richard Quadling >> Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731 >> "Standing on the shoulders of some very clever giants!" > > > Hmm.. Currently, the iframe has no HTML/CSS/JS content as the server simply supplies a download which causes the browser to ask to save. I'm using PHP and here is the key part. // Generate file and then supply headers along with the data. header("{$_SERVER['SERVER_PROTOCOL']} 200 OK", True, 200); header('Content-Description: File Transfer'); header("Content-Type: {$_SESSION['Reports'][$_GET['Hash']]['ExportInfo']['Mime']}"); header('Content-Disposition: attachment; filename="' . $_SESSION['Reports'][$_GET['Hash']]['Report']['ExternalName'] . '.' . $_SESSION['Reports'][$_GET['Hash']]['ExportInfo']['Extension'] . '"'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($s_ExportedReport)); readfile($s_ExportedReport); unlink($s_ExportedReport); So, I can't add HTML/CSS/JS to the frame AND have the download happen. I found I can observe the "load" event on the iframe, but only in FireFox. It seems that nothing is fired for IE/Chrome at all. Also tried dom:loaded - nothing in any of the browsers. I think the above code would need to be amended to do something like this ... Generate the report and save it with a unique name. Generate the iframe's HTML so that it includes the JS to tell the parent all is well and a location.refresh to point to a script to supply the newly generated file. Seems convoluted, but then again, downloading with no refresh SEEMS convoluted anyway. And as I'm typing this, Alex has just replied ... reading. Ah. Yes. If the iframe had content, then I could traverse it quite happily. Breaking the generation and the downloading seems to be the next obvious way. Any other POVs? Richard. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~-~--~~~---~--~~ 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: User triggered download with no page refresh.
2009/3/2 Richard Quadling : > 2009/3/2 zero : >> >> On page that iframe load u can put code: >> >> parent.name_of_some_js_function(); >> >> Works for me in all browsers. >> >> On 2 Mar, 14:21, Richard Quadling wrote: >>> Hi. >>> >>> I'm currently using an iframe to act as a report downloader. >>> >>> The user enters some criteria which is generated dynamically as they >>> change options. They then click a document button (PDF, XLS, DOC) and >>> this is sent to the server for validation. The result is a key for the >>> Crystal Reports. The JS code generates an iframe and passes the key as >>> part of the URL. As the key is a hash, and has to be part of the >>> user's session, security is quite high. Guessing keys is useless >>> unless there is corresponding data already submitted for the key. >>> >>> On screen, I dim the form for ajax requests and fade in a spinner. >>> >>> So far so good. >>> >>> My problem is that once I've created the iframe I've no way of knowing >>> about the state of the iframe - has it loaded and presented the user >>> with the appropriate download box. >>> >>> Are there any events I can observe with regard to an iframe (ie7, FF, >>> Chrome - intranet only and so can be limited in support). >>> >>> I suppose as a side question, how do I find what events are observable >>> for any element? Is there a way? Or is it just a case of RTF HTML/JS M >>> >>> Regards, >>> >>> Richard Quadling. >>> >>> -- >>> - >>> Richard Quadling >>> Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731 >>> "Standing on the shoulders of some very clever giants!" >> >> >> > > Hmm.. > > Currently, the iframe has no HTML/CSS/JS content as the server simply > supplies a download which causes the browser to ask to save. I'm using > PHP and here is the key part. > > // Generate file and then supply headers along with the data. > header("{$_SERVER['SERVER_PROTOCOL']} 200 OK", True, 200); > header('Content-Description: File Transfer'); > header("Content-Type: > {$_SESSION['Reports'][$_GET['Hash']]['ExportInfo']['Mime']}"); > header('Content-Disposition: attachment; filename="' . > $_SESSION['Reports'][$_GET['Hash']]['Report']['ExternalName'] . '.' . > $_SESSION['Reports'][$_GET['Hash']]['ExportInfo']['Extension'] . '"'); > header('Content-Transfer-Encoding: binary'); > header('Expires: 0'); > header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); > header('Pragma: public'); > header('Content-Length: ' . filesize($s_ExportedReport)); > readfile($s_ExportedReport); > unlink($s_ExportedReport); > > So, I can't add HTML/CSS/JS to the frame AND have the download happen. > > I found I can observe the "load" event on the iframe, but only in > FireFox. It seems that nothing is fired for IE/Chrome at all. Also > tried dom:loaded - nothing in any of the browsers. > > I think the above code would need to be amended to do something like this ... > > Generate the report and save it with a unique name. > Generate the iframe's HTML so that it includes the JS to tell the > parent all is well and a location.refresh to point to a script to > supply the newly generated file. > > Seems convoluted, but then again, downloading with no refresh SEEMS > convoluted anyway. > > And as I'm typing this, Alex has just replied ... reading. > > Ah. Yes. If the iframe had content, then I could traverse it quite happily. > > Breaking the generation and the downloading seems to be the next obvious way. > > Any other POVs? > > Richard. > > > -- > - > Richard Quadling > Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 > "Standing on the shoulders of some very clever giants!" > Or duh ... http://particletree.com/notebook/ajax-file-download-or-not/ Is this right? A straight form with a download link (i.e. form's response will be downloadable file?) Just triggered using JS? Hmm.. Of course that will work,but I still don't know when the form is ready. So maybe a form event to know it has finished processing would be a better/easier solution ... looking into it ... -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~-~--~~~---~--~~ 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: User triggered download with no page refresh.
The way i do it in my custom CRM (for editing and downloading invoices (Mainly PDF's)) is to submit a form to a hidden Iframe which automatically calls the browser to open or download the document ... This is streamed in a similar way to your streaming that you mentioned earlier .. what i would do in your case is when all the headers are sent to the browser i would echo some javascript to call the parent telling it that it is finished ... Example in your ajax request set evalScripts to 'true' and send some JS back to the server ... if this is unsecure for you then just echo out some HTML that you can query .. The only downside of echoing out HTML is you may have to periodically check the DOM to see if its there or not ... at least with echoing javascript it will do something when responded .. Now .. the downside with PHP is ... quite often javascript is interpretted before a [PHP] script has finished executing (i allways wrap my scripts with EG. if($sql) {echo("alert('Finished');");} else { ... } (this one scratched my head a few times windering why Ajax Requests were reposnding before a database change had ben done !!! ... If its high load server then you can put a sleep call in php or buffer the output slightly to compensate for it .. I dont know why php does this and it may be the same in other serverside languages ... most of the time the script executes before the javascript is interpreted so it doesnt matter but on high load servers thismight not allways be the case HTH Alex - Original Message - From: "Richard Quadling" To: Sent: Monday, March 02, 2009 2:02 PM Subject: [Proto-Scripty] Re: User triggered download with no page refresh. 2009/3/2 Richard Quadling : > 2009/3/2 zero : >> >> On page that iframe load u can put code: >> >> parent.name_of_some_js_function(); >> >> Works for me in all browsers. >> >> On 2 Mar, 14:21, Richard Quadling wrote: >>> Hi. >>> >>> I'm currently using an iframe to act as a report downloader. >>> >>> The user enters some criteria which is generated dynamically as they >>> change options. They then click a document button (PDF, XLS, DOC) and >>> this is sent to the server for validation. The result is a key for the >>> Crystal Reports. The JS code generates an iframe and passes the key as >>> part of the URL. As the key is a hash, and has to be part of the >>> user's session, security is quite high. Guessing keys is useless >>> unless there is corresponding data already submitted for the key. >>> >>> On screen, I dim the form for ajax requests and fade in a spinner. >>> >>> So far so good. >>> >>> My problem is that once I've created the iframe I've no way of knowing >>> about the state of the iframe - has it loaded and presented the user >>> with the appropriate download box. >>> >>> Are there any events I can observe with regard to an iframe (ie7, FF, >>> Chrome - intranet only and so can be limited in support). >>> >>> I suppose as a side question, how do I find what events are observable >>> for any element? Is there a way? Or is it just a case of RTF HTML/JS M >>> >>> Regards, >>> >>> Richard Quadling. >>> >>> -- >>> - >>> Richard Quadling >>> Zend Certified Engineer >>> :http://zend.com/zce.php?c=ZEND002498&r=213474731 >>> "Standing on the shoulders of some very clever giants!" >> >> >> > > Hmm.. > > Currently, the iframe has no HTML/CSS/JS content as the server simply > supplies a download which causes the browser to ask to save. I'm using > PHP and here is the key part. > > // Generate file and then supply headers along with the data. > header("{$_SERVER['SERVER_PROTOCOL']} 200 OK", True, 200); > header('Content-Description: File Transfer'); > header("Content-Type: > {$_SESSION['Reports'][$_GET['Hash']]['ExportInfo']['Mime']}"); > header('Content-Disposition: attachment; filename="' . > $_SESSION['Reports'][$_GET['Hash']]['Report']['ExternalName'] . '.' . > $_SESSION['Reports'][$_GET['Hash']]['ExportInfo']['Extension'] . '"'); > header('Content-Transfer-Encoding: binary'); > header('Expires: 0'); > header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); > header('Pragma: public'); > header('Content-Length: ' . filesize($s_ExportedReport)); > readfile($s_ExportedReport); > unlink($s_ExportedReport); > > So, I can't add HTML/CSS/JS to the frame AND have the download happen. > > I found I can observe the "load" event on the iframe, but only in > FireFox. It seems that nothing is fired for IE/Chrome at all. Also > tried dom:loaded - nothing in any of the browsers. > > I think the above code would need to be amended to do something like this > ... > > Generate the report and save it with a unique name. > Generate the iframe's HTML so that it includes the JS to tell the > parent all is well and a location.refresh to point to a script to > supply the newly generated file. > > Seems convoluted, but then again, downloading with no refresh SEEMS > convoluted anyway. > > And as I'm typing this, Alex has ju
[Proto-Scripty] Re: User triggered download with no page refresh.
2009/3/2 Alex Mcauley : > > The way i do it in my custom CRM (for editing and downloading invoices > (Mainly PDF's)) is to submit a form to a hidden Iframe which automatically > calls the browser to open or download the document ... > > This is streamed in a similar way to your streaming that you mentioned > earlier .. > > what i would do in your case is when all the headers are sent to the browser > i would echo some javascript to call the parent telling it that it is > finished ... > > Example in your ajax request set evalScripts to 'true' and send some JS back > to the server ... if this is unsecure for you then just echo out some HTML > that you can query .. > > The only downside of echoing out HTML is you may have to periodically check > the DOM to see if its there or not ... at least with echoing javascript it > will do something when responded .. > > Now .. the downside with PHP is ... quite often javascript is interpretted > before a [PHP] script has finished executing (i allways wrap my scripts > with EG. if($sql) {echo("alert('Finished');");} else { > ... } (this one scratched my head a few times windering why Ajax Requests > were reposnding before a database change had ben done !!! ... > > If its high load server then you can put a sleep call in php or buffer the > output slightly to compensate for it .. > > I dont know why php does this and it may be the same in other serverside > languages ... most of the time the script executes before the javascript is > interpreted so it doesnt matter but on high load servers thismight not > allways be the case > > HTH > > Alex > > > > > - Original Message - > From: "Richard Quadling" > To: > Sent: Monday, March 02, 2009 2:02 PM > Subject: [Proto-Scripty] Re: User triggered download with no page refresh. > > > > 2009/3/2 Richard Quadling : >> 2009/3/2 zero : >>> >>> On page that iframe load u can put code: >>> >>> parent.name_of_some_js_function(); >>> >>> Works for me in all browsers. >>> >>> On 2 Mar, 14:21, Richard Quadling wrote: Hi. I'm currently using an iframe to act as a report downloader. The user enters some criteria which is generated dynamically as they change options. They then click a document button (PDF, XLS, DOC) and this is sent to the server for validation. The result is a key for the Crystal Reports. The JS code generates an iframe and passes the key as part of the URL. As the key is a hash, and has to be part of the user's session, security is quite high. Guessing keys is useless unless there is corresponding data already submitted for the key. On screen, I dim the form for ajax requests and fade in a spinner. So far so good. My problem is that once I've created the iframe I've no way of knowing about the state of the iframe - has it loaded and presented the user with the appropriate download box. Are there any events I can observe with regard to an iframe (ie7, FF, Chrome - intranet only and so can be limited in support). I suppose as a side question, how do I find what events are observable for any element? Is there a way? Or is it just a case of RTF HTML/JS M Regards, Richard Quadling. -- - Richard Quadling Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" >>> >> >>> >> >> Hmm.. >> >> Currently, the iframe has no HTML/CSS/JS content as the server simply >> supplies a download which causes the browser to ask to save. I'm using >> PHP and here is the key part. >> >> // Generate file and then supply headers along with the data. >> header("{$_SERVER['SERVER_PROTOCOL']} 200 OK", True, 200); >> header('Content-Description: File Transfer'); >> header("Content-Type: >> {$_SESSION['Reports'][$_GET['Hash']]['ExportInfo']['Mime']}"); >> header('Content-Disposition: attachment; filename="' . >> $_SESSION['Reports'][$_GET['Hash']]['Report']['ExternalName'] . '.' . >> $_SESSION['Reports'][$_GET['Hash']]['ExportInfo']['Extension'] . '"'); >> header('Content-Transfer-Encoding: binary'); >> header('Expires: 0'); >> header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); >> header('Pragma: public'); >> header('Content-Length: ' . filesize($s_ExportedReport)); >> readfile($s_ExportedReport); >> unlink($s_ExportedReport); >> >> So, I can't add HTML/CSS/JS to the frame AND have the download happen. >> >> I found I can observe the "load" event on the iframe, but only in >> FireFox. It seems that nothing is fired for IE/Chrome at all. Also >> tried dom:loaded - nothing in any of the browsers. >> >> I think the above code would need to be amended to do something like this >> ... >> >> Generate the report and save it with a unique name. >> Generate the iframe's HTML so that it includes the JS to tell the >> parent all is well and a location.refresh to point to a script
[Proto-Scripty] How do sort a hash.
Hi. This might be one of the those odd situations where there is no answer, but I have a hash coming from PHP via JSONP to JS/Prototype. In IE and FF, the ordering is maintained. In Chrome the order is not maintained. The key part is numeric and is NOT in order. The value is sorted alphabetically. I suppose I could reverse the key/value pairing and work that way, but as the dox say, order is not guaranteed. Alternatively, as the data is going to be used for a tag, can I sort the s by value? Regards, Richard -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~-~--~~~---~--~~ 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: How do sort a hash.
2009/3/2 Richard Quadling : > Hi. > > This might be one of the those odd situations where there is no > answer, but I have a hash coming from PHP via JSONP to JS/Prototype. > > In IE and FF, the ordering is maintained. > > In Chrome the order is not maintained. > > The key part is numeric and is NOT in order. The value is sorted > alphabetically. > > I suppose I could reverse the key/value pairing and work that way, but > as the dox say, order is not guaranteed. > > Alternatively, as the data is going to be used for a tag, can > I sort the s by value? > > Regards, > > Richard > > > -- > - > Richard Quadling > Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 > "Standing on the shoulders of some very clever giants!" > Hey! I'm cooking today on gas today! Rather than ... $H(a_Values).each(...) I use ... $A($H(a_Values).each(function(h_Value) { return [h_Value.key, h_Value.value]; })).sort(function(a, b) { return a[1] < b[1] ? -1 : (a[1] > b[1] ? 1 : 0); }).each(...) Which looks really really messy, but works for me in Chrome, IE and FF. -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~-~--~~~---~--~~ 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: How do sort a hash.
On Mar 2, 9:58 am, Richard Quadling wrote: > Hi. > > This might be one of the those odd situations where there is no > answer, but I have a hash coming from PHP via JSONP to JS/Prototype. > > In IE and FF, the ordering is maintained. > > In Chrome the order is not maintained. > > The key part is numeric and is NOT in order. The value is sorted > alphabetically. > > I suppose I could reverse the key/value pairing and work that way, but > as the dox say, order is not guaranteed. > > Alternatively, as the data is going to be used for a tag, can > I sort the s by value? Look into `sortBy`: $H({ a: 20, b: 1, c: 10 }).sortBy(function(pair){ return pair.value; // or `return pair.key` (to sort by key) }); [...] -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: How do sort a hash.
2009/3/2 kangax : > > On Mar 2, 9:58 am, Richard Quadling wrote: >> Hi. >> >> This might be one of the those odd situations where there is no >> answer, but I have a hash coming from PHP via JSONP to JS/Prototype. >> >> In IE and FF, the ordering is maintained. >> >> In Chrome the order is not maintained. >> >> The key part is numeric and is NOT in order. The value is sorted >> alphabetically. >> >> I suppose I could reverse the key/value pairing and work that way, but >> as the dox say, order is not guaranteed. >> >> Alternatively, as the data is going to be used for a tag, can >> I sort the s by value? > > Look into `sortBy`: > > $H({ a: 20, b: 1, c: 10 }).sortBy(function(pair){ > return pair.value; > // or `return pair.key` (to sort by key) > }); > > [...] > > -- > kangax > > > Argh!!! Thank you Kangax. I think this would be a great case for cross linking in the documentation. Hash can be thought of as an associative array, binding unique keys to values (which are not necessarily unique), though it can not guarantee consistent order its elements when iterating, "but sortBy() can alleviate this issue." Is there a way I can commit changes to the documentation? -- - Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~-~--~~~---~--~~ 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: validation for alphanumeric field/sequence
Hi, On Feb 4, 10:50 pm, Michael wrote: > Hi - I want to use this validation for an alphanumeric field. I apologize for beating a dead horse, but since the list of possible choices is closed, why don't you just use a SELECT element? :o) Anyways, it was very interesting to read about all possible methods, even if I am now (even more) confused about Javascript and hashes :o/ (I thought that native JS objects were great hashes, but I am obviously wrong there...). Eric --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: JSON form generator demo
Hi Rob, No, I haven't made a comparison. I have built client-side form generators before but have used XML for the form schema. JSON is obviously faster than XML. Generating the entire form server-side and inserting it as a single block would obviously be faster than generating fields one at a time on the client. That being said, there doesn't seem to be a visible difference to the user performance-wise. On Mar 1, 8:01 pm, RobG wrote: > On Feb 21, 7:32 am, Diodeus wrote: > > > Hello Prototypers, > > > I've been working on a JSON-based form generator that uses Prototype. > > > Basically it allows you provide a form specification using JSON and > > the engine generates the output dynamically. > > > It's still in the early stages but there is a working demo. I am > > looking for comments and feedback. > > Have you compared the difference in performance between running a > database query, creating the JSON, sending it to the client and > building the form there vs building the form on the server directly > from the database query and sending the HTML ready to insert? > > -- > Rob --~--~-~--~~~---~--~~ 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: How do sort a hash.
On Mar 2, 11:23 am, Richard Quadling wrote: > 2009/3/2 kangax : > > > > > > > On Mar 2, 9:58 am, Richard Quadling wrote: > >> Hi. > > >> This might be one of the those odd situations where there is no > >> answer, but I have a hash coming from PHP via JSONP to JS/Prototype. > > >> In IE and FF, the ordering is maintained. > > >> In Chrome the order is not maintained. > > >> The key part is numeric and is NOT in order. The value is sorted > >> alphabetically. > > >> I suppose I could reverse the key/value pairing and work that way, but > >> as the dox say, order is not guaranteed. > > >> Alternatively, as the data is going to be used for a tag, can > >> I sort the s by value? > > > Look into `sortBy`: > > > $H({ a: 20, b: 1, c: 10 }).sortBy(function(pair){ > > return pair.value; > > // or `return pair.key` (to sort by key) > > }); > > > [...] > > > -- > > kangax > > Argh!!! Thank you Kangax. > > I think this would be a great case for cross linking in the documentation. > > Hash can be thought of as an associative array, binding unique keys to > values (which are not necessarily unique), though it can not guarantee > consistent order its elements when iterating, "but sortBy() can > alleviate this issue." I actually find plain JS object sufficient most of the time for "hashtable" purposes. There are edge cases of course, but the performance gains of using plain objects (vs. `Hash` instances) can not be underestimated. > > Is there a way I can commit changes to the documentation? Sure. Create a ticket at Lighthouse and mark it as a documentation related enhancement. -- kangax --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: does prototype abstract usage to both IE & mozilla?
Hi guys, I've just come across http://jalava.buildyourownapps.com I'm just seeing now that for a diagram editor there seems to be 2 approaches from what I can tell, one based on real drawing (e.g. raphaeljs, or canvas tag), and the other using the capabilities of layout inherit using HTML/CSS/etc which is what the above-mentioned jalava is doing I think (or I think the commercial http://mxgraph.com is using this also) Any comments here? Would you agree that using the HTML/CSS layout capabilities (which seems to lay in being able to do absolute positioning of objects) would be a better fit? This would also get around any issues re Canvas tag support cross-browsers? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] IE7 Timers & Memory Leaks?
Hidie-ho, Well Ok, I've used setTimeout a few times in my code to delay resuming run of a code module until Ajax.Request() has had time to do its thing. And the use of the timer is cyclic as the user may repeat the operation over and over again, but in different parts of the page. And ... holy spacetime wormhole continuum out of wack batman! Why is that timer firing off so quickly? What in the wide wide world of sports is go'n on? Robin, haven't you done a web search yet? There's people complaining about memory leaks with regard to timers? Holy abscent minded browser batman! Is it the setTimeout() function causing the problem? Damned if I know Robin, I only stomp on Penquins and Jokers, not memory leaks and I'm not int he habit of waiting for anything, not even queues at the bank when I cash my checks. Holy Fast Food Diet out the window with Cheese, Fries and Shake Batman! What's the answer? You weren't listening Robin ... damned if I know. Does anyone know? BearState --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Prototype effects below flash animation
I need the prototype div stay over a flash animation ? how can it be done ? Today i open a bigger image using the code in this post and the flash animation appears over the bigger image Thank´s in advance On 28 fev, 12:46, Walter Lee Davis wrote: > I'm not sure this will help in all cases. Flash content cuts a > "window" all the way through the z-axis of the page, nothing (except > more Flash) may be drawn in a movie's "airspace". The browser hands > over screen-drawing in the entire rectangle of the movie to the Flash > plug-in. If you want to float another Flash movie over an existing > Flash movie, that *will* work, and (as long as you have set > wmode:transparent on the top-most movie) it will look the way you want > it to. > > Walter > > On Feb 27, 2009, at 5:35 PM, Boysenberry Payne wrote: > > > > > Try either setting the z-index css style for both so that the effects > > div is a higher number --~--~-~--~~~---~--~~ 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: IE7 Timers & Memory Leaks?
Hi again, BearState. Your confusing different things here. The behaviour you are describing isn't related to memory leaks at all, your most probably just passing the _result_ of a function call to setTimeout rather than the function itself. In other words, if you are doing the following, you're almost certainly doing something wrong (or using some very obscure functional programming tricks): setTimeout(myFunc(), 1000); // WRONG This, on the contrary, works you're passing the function itself, not the _result_ of it): setTimeout(myFunc, 1000); // CORRECT Anyway, if you're doing ajax requests, you should NOT be using timeouts, but the provided callback system (as advised in a previous post). I suggest you buy yourself a good book on Prototype[1] and maybe one on JavaScript too, while you're at it. ;) Best, Tobie [1] http://prototypejs.org/2008/8/11/practical-prototype-and-scriptaculous or http://prototypejs.org/2007/5/7/prototype-and-script-aculo-us-the-bungie-book-has-landed On Mar 3, 1:43 am, BearState wrote: > Hidie-ho, > > Well Ok, I've used setTimeout a few times in my code to delay resuming > run of a code module until Ajax.Request() has had time to do its > thing. And the use of the timer is cyclic as the user may repeat the > operation over and over again, but in different parts of the page. > > And ... holy spacetime wormhole continuum out of wack batman! Why is > that timer firing off so quickly? What in the wide wide world of > sports is go'n on? > > Robin, haven't you done a web search yet? There's people complaining > about memory leaks with regard to timers? > > Holy abscent minded browser batman! Is it the setTimeout() function > causing the problem? > > Damned if I know Robin, I only stomp on Penquins and Jokers, not > memory leaks and I'm not int he habit of waiting for anything, not > even queues at the bank when I cash my checks. > > Holy Fast Food Diet out the window with Cheese, Fries and Shake > Batman! What's the answer? > > You weren't listening Robin ... damned if I know. > > Does anyone know? > > BearState --~--~-~--~~~---~--~~ 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: IE7 Timers & Memory Leaks?
Hi Tobie, You don't live over in Scott's Valley, do you? Used to know a Tobie way back when. OK so, xtimer = setTimeout( { doSomething( arg1, arg2, arg3 ); }, 500); is using the function's return? How do I specifiy a function to setTimeout when it has args? Holy Simple Minded Idiot Batman! It's not a timer memory leak problem. Riddle me this Robin ... do you think this programmer could use some Bat Belt and Suspenders? Holy Mistaken Bug Identity Batman! Definitely! BearState On Mar 2, 6:55 pm, Tobie Langel wrote: > Hi again, BearState. > > Your confusing different things here. > > The behaviour you are describing isn't related to memory leaks at all, > your most probably just passing the _result_ of a function call to > setTimeout rather than the function itself. > > In other words, if you are doing the following, you're almost > certainly doing something wrong (or using some very obscure functional > programming tricks): > > setTimeout(myFunc(), 1000); // WRONG > > This, on the contrary, works you're passing the function itself, not > the _result_ of it): > > setTimeout(myFunc, 1000); // CORRECT > > Anyway, if you're doing ajax requests, you should NOT be using > timeouts, but the provided callback system (as advised in a previous > post). > > I suggest you buy yourself a good book on Prototype[1] and maybe one > on JavaScript too, while you're at it. ;) > > Best, > > Tobie > > [1]http://prototypejs.org/2008/8/11/practical-prototype-and-scriptaculous > orhttp://prototypejs.org/2007/5/7/prototype-and-script-aculo-us-the-bun... > > On Mar 3, 1:43 am, BearState wrote: > > > > > Hidie-ho, > > > Well Ok, I've used setTimeout a few times in my code to delay resuming > > run of a code module until Ajax.Request() has had time to do its > > thing. And the use of the timer is cyclic as the user may repeat the > > operation over and over again, but in different parts of the page. > > > And ... holy spacetime wormhole continuum out of wack batman! Why is > > that timer firing off so quickly? What in the wide wide world of > > sports is go'n on? > > > Robin, haven't you done a web search yet? There's people complaining > > about memory leaks with regard to timers? > > > Holy abscent minded browser batman! Is it the setTimeout() function > > causing the problem? > > > Damned if I know Robin, I only stomp on Penquins and Jokers, not > > memory leaks and I'm not int he habit of waiting for anything, not > > even queues at the bank when I cash my checks. > > > Holy Fast Food Diet out the window with Cheese, Fries and Shake > > Batman! What's the answer? > > > You weren't listening Robin ... damned if I know. > > > Does anyone know? > > > BearState- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Password field as hint
See if this would help you. It's based on the classic A List Apart article, but just written now off the top of my head: Name Password Shoe Size $$('input').each(function(elm){ if(label = elm.up('p').down('label')){ var label = $(label); label.setStyle({zIndex: 2,position:'absolute',top:'3px',left:'3px',color:'#666'}); elm.observe('focus',function(evt){label.hide()}); elm.observe('blur',function(evt){if(!elm.present()) label.show()}); } }); Walter On Mar 2, 2009, at 7:16 AM, Quleczka wrote: > Still is really messy, I don't have time right now to make it nicer :) --~--~-~--~~~---~--~~ 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: IE7 Timers & Memory Leaks?
myTimeout=setTimeout(function(var,var2,var3,var4) { global x,y,z; alert('foo = bar'); },5000); whats wrong with that ? I dont think this leaks memory so why should any timeout leak memory Alex - Original Message - From: "BearState" To: "Prototype & script.aculo.us" Sent: Tuesday, March 03, 2009 3:36 AM Subject: [Proto-Scripty] Re: IE7 Timers & Memory Leaks? Hi Tobie, You don't live over in Scott's Valley, do you? Used to know a Tobie way back when. OK so, xtimer = setTimeout( { doSomething( arg1, arg2, arg3 ); }, 500); is using the function's return? How do I specifiy a function to setTimeout when it has args? Holy Simple Minded Idiot Batman! It's not a timer memory leak problem. Riddle me this Robin ... do you think this programmer could use some Bat Belt and Suspenders? Holy Mistaken Bug Identity Batman! Definitely! BearState On Mar 2, 6:55 pm, Tobie Langel wrote: > Hi again, BearState. > > Your confusing different things here. > > The behaviour you are describing isn't related to memory leaks at all, > your most probably just passing the _result_ of a function call to > setTimeout rather than the function itself. > > In other words, if you are doing the following, you're almost > certainly doing something wrong (or using some very obscure functional > programming tricks): > > setTimeout(myFunc(), 1000); // WRONG > > This, on the contrary, works you're passing the function itself, not > the _result_ of it): > > setTimeout(myFunc, 1000); // CORRECT > > Anyway, if you're doing ajax requests, you should NOT be using > timeouts, but the provided callback system (as advised in a previous > post). > > I suggest you buy yourself a good book on Prototype[1] and maybe one > on JavaScript too, while you're at it. ;) > > Best, > > Tobie > > [1]http://prototypejs.org/2008/8/11/practical-prototype-and-scriptaculous > orhttp://prototypejs.org/2007/5/7/prototype-and-script-aculo-us-the-bun... > > On Mar 3, 1:43 am, BearState wrote: > > > > > Hidie-ho, > > > Well Ok, I've used setTimeout a few times in my code to delay resuming > > run of a code module until Ajax.Request() has had time to do its > > thing. And the use of the timer is cyclic as the user may repeat the > > operation over and over again, but in different parts of the page. > > > And ... holy spacetime wormhole continuum out of wack batman! Why is > > that timer firing off so quickly? What in the wide wide world of > > sports is go'n on? > > > Robin, haven't you done a web search yet? There's people complaining > > about memory leaks with regard to timers? > > > Holy abscent minded browser batman! Is it the setTimeout() function > > causing the problem? > > > Damned if I know Robin, I only stomp on Penquins and Jokers, not > > memory leaks and I'm not int he habit of waiting for anything, not > > even queues at the bank when I cash my checks. > > > Holy Fast Food Diet out the window with Cheese, Fries and Shake > > Batman! What's the answer? > > > You weren't listening Robin ... damned if I know. > > > Does anyone know? > > > BearState- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---