[Proto-Scripty] Re: Event ordering for cross domain frames
Hi sumit, as explain in the previous post, I have not tested any code, and could not do any test actually. Do you have any live page we can test? It could be easier this way :)) -- david On 9 déc, 13:36, Sumit skbrnwl-...@yahoo.com wrote: Hi, So i finally came up with protoype based implementation for crossdomain iframe communication based on Julien's example as can be seen live inhttp://www.julienlecomte.net/blogfiles/cross-frame/For quick reference, lets say an iframe from domain B is hosted on main site from domain A. In order to talk to the main site, iframe creates an iframe loading proxy file from domain B which passes on the message from its current location to the main site using custom event notification mechanism (because both belong to the same domain B). As soon as the message is delivered (part of loading of the iframe's body), in iframe's onload event, iframe is destroyed after cleaning up the listeners attached to it. Now comes my problem. These messages are reaching fine across different domains. But the order is not guaranteed. I think this is more so because of the loading order of the iframes that are dynamically created for each message and then destroyed. Is there a way i could ensure the ordered delivery? I tried to reuse the iframes for multiple messages (not destroying at the end of the message delivery); but then location update is not communicated to the iframe (should have happened in onload listener, but it doesn't). Any idea what could be done? For more reference on crossdomain communication with iframes, please seehttp://softwareas.com/cross-domain-communication-with-iframes Thanks in advance for any pointers. -Sumit -- 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: Event ordering for cross domain frames
Hi sumit, !! repost, it seems that an error delete my previous response !! As I said, I did not have possibility to test what you're trying to do, Could we have a live page so that it will be easier to point the trouble ?? -- david On 9 déc, 19:36, Sumit skbrnwl-...@yahoo.com wrote: Hi, So i finally came up with protoype based implementation for crossdomain iframe communication based on Julien's example as can be seen live inhttp://www.julienlecomte.net/blogfiles/cross-frame/For quick reference, lets say an iframe from domain B is hosted on main site from domain A. In order to talk to the main site, iframe creates an iframe loading proxy file from domain B which passes on the message from its current location to the main site using custom event notification mechanism (because both belong to the same domain B). As soon as the message is delivered (part of loading of the iframe's body), in iframe's onload event, iframe is destroyed after cleaning up the listeners attached to it. Now comes my problem. These messages are reaching fine across different domains. But the order is not guaranteed. I think this is more so because of the loading order of the iframes that are dynamically created for each message and then destroyed. Is there a way i could ensure the ordered delivery? I tried to reuse the iframes for multiple messages (not destroying at the end of the message delivery); but then location update is not communicated to the iframe (should have happened in onload listener, but it doesn't). Any idea what could be done? For more reference on crossdomain communication with iframes, please seehttp://softwareas.com/cross-domain-communication-with-iframes Thanks in advance for any pointers. -Sumit -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Progressive update messages from single request
Hi joe, I think that what you try to do could not be handle with AJAX.request (). In fact you'll receive control on a callback in the AJAX.request() when the response is complete in the browser. What you could do is a pure HTML solution: create an iFrame inside your page, and set its location to the request you made, next treat this request in server and use flush() function to send a part of the response a On 9 déc, 22:51, joe t. thooke...@gmail.com wrote: Thanks for the response Walter. i can see where you're going with that, but in those successively created new Ajax.Request calls, it's generating a new request to the server, which runs the server-side routine from the beginning, right? In my concept, the first call commands the server to run all three steps: Client Request 1 -- Collect the data (send feedback to client) -- Create the PDF (send feedback to client) -- Attach to an email and send (send final feedback) End Where your structure more resembles: Client Request 1 -- Collect data (send Feedback 1) -- Client Request 2 -- Create PDF (send Feedback 2) -- Client Request 3 -- Attach and email (send Feedback 3) End Am i correct? If so, that works only to the amount of detail i provide nested invocations of Ajax.Request to check/perform one specific detail of progress. Keep in mind this is only an example: what if i need feedback during the attachment process (attaching 1 of 100 files)? For one, it would be nasty to nest that many Ajax.Request calls, and more importantly, that email object only exists within the request that creates and processes it. The second request to attach file 2 of 100 isn't working on the same email object (as i understand it). i did find one QA similar to this where it was suggested to use $_SESSION for the current progress message... The initial Request gets the server going on the task, and also creates a second Request that repeats (eg, Ajax.PeriodicalUpdater). That one does nothing more than check $_SESSION for the latest message (which gets updated by the task being performed). That feels slightly better to me, despite the potential traffic overhead for longer requests (hence the {decay} option, i suppose). Something for me to chew on, i suppose. Thanks again, -joe t. On Dec 9, 1:22 pm, Walter Lee Davis wa...@wdstudio.com wrote: I would do this with chained onSuccess handlers. Each one would trigger a new request to a different endpoint, carrying some token to identify the visitor. $('button').observe('click',function(evt){ //do your lookup new Ajax.Request('lookup.php',{ parameters:{id:'?=$id?'}, onCreate:function(){ $('message').update('searching...');; }, onSuccess:function(transport){ //make your pdf $('message').update('making PDF...');; new Ajax.Request('pdf.php',{ parameters:{id:'?=$id?'}, onCreate:..., //you get the idea onSuccess:... }); } }}; }); Walter On Dec 9, 2009, at 11:11 AM, joe t. wrote: i think i've seen examples of this, but can't recall where, and could use some guidance. Obviously it's easy to handle a 1:1 Request/Response How can i do a true 1:many process? For instance: Client takes a single action which requires the server to perform 3 tasks: * Query database * Generate PDF * Generate email, attach PDF, and send How can i respond to the client as EACH task is accomplished without ending the request chain? Looking up your data . . . (time-based dots as delay indicator) Creating PDF . . . Email sent (or failed, as the case may be) Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can point me in the right direction (which include samples), i'd be grateful. Thanks. -joe t. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . For more options, visit this group athttp://groups.google.com/group/prototype-scriptaculous?hl=en . -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Progressive update messages from single request
Hi again, I'm having big finger this morning :)) so let's continue: What you could do is a pure HTML solution: create an iFrame inside your page, and set its location to the request you made, next treat this request in the server and use flush() function (in PHP) to send a part of the response. This could be Looking up your data and at each server styep, just flush() a dot to indicate progression. Then continue like this to indicate the progression inside the iFrame. When finish, just remove the iFrame to indicate it's finished to the user. -- david On 10 déc, 09:13, david david.brill...@gmail.com wrote: Hi joe, I think that what you try to do could not be handle with AJAX.request (). In fact you'll receive control on a callback in the AJAX.request() when the response is complete in the browser. What you could do is a pure HTML solution: create an iFrame inside your page, and set its location to the request you made, next treat this request in server and use flush() function to send a part of the response a On 9 déc, 22:51, joe t. thooke...@gmail.com wrote: Thanks for the response Walter. i can see where you're going with that, but in those successively created new Ajax.Request calls, it's generating a new request to the server, which runs the server-side routine from the beginning, right? In my concept, the first call commands the server to run all three steps: Client Request 1 -- Collect the data (send feedback to client) -- Create the PDF (send feedback to client) -- Attach to an email and send (send final feedback) End Where your structure more resembles: Client Request 1 -- Collect data (send Feedback 1) -- Client Request 2 -- Create PDF (send Feedback 2) -- Client Request 3 -- Attach and email (send Feedback 3) End Am i correct? If so, that works only to the amount of detail i provide nested invocations of Ajax.Request to check/perform one specific detail of progress. Keep in mind this is only an example: what if i need feedback during the attachment process (attaching 1 of 100 files)? For one, it would be nasty to nest that many Ajax.Request calls, and more importantly, that email object only exists within the request that creates and processes it. The second request to attach file 2 of 100 isn't working on the same email object (as i understand it). i did find one QA similar to this where it was suggested to use $_SESSION for the current progress message... The initial Request gets the server going on the task, and also creates a second Request that repeats (eg, Ajax.PeriodicalUpdater). That one does nothing more than check $_SESSION for the latest message (which gets updated by the task being performed). That feels slightly better to me, despite the potential traffic overhead for longer requests (hence the {decay} option, i suppose). Something for me to chew on, i suppose. Thanks again, -joe t. On Dec 9, 1:22 pm, Walter Lee Davis wa...@wdstudio.com wrote: I would do this with chained onSuccess handlers. Each one would trigger a new request to a different endpoint, carrying some token to identify the visitor. $('button').observe('click',function(evt){ //do your lookup new Ajax.Request('lookup.php',{ parameters:{id:'?=$id?'}, onCreate:function(){ $('message').update('searching...');; }, onSuccess:function(transport){ //make your pdf $('message').update('making PDF...');; new Ajax.Request('pdf.php',{ parameters:{id:'?=$id?'}, onCreate:..., //you get the idea onSuccess:... }); } }}; }); Walter On Dec 9, 2009, at 11:11 AM, joe t. wrote: i think i've seen examples of this, but can't recall where, and could use some guidance. Obviously it's easy to handle a 1:1 Request/Response How can i do a true 1:many process? For instance: Client takes a single action which requires the server to perform 3 tasks: * Query database * Generate PDF * Generate email, attach PDF, and send How can i respond to the client as EACH task is accomplished without ending the request chain? Looking up your data . . . (time-based dots as delay indicator) Creating PDF . . . Email sent (or failed, as the case may be) Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can point me in the right direction (which include samples), i'd be grateful. Thanks. -joe t. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send
[Proto-Scripty] Slideshow: how to maintain current slide between manual adv and auto adv
This is hard to explain in a short subject line. I have a slideshow that is set to auto advance and can be paused and played, but can also be manually advanced or reversed by click on arrow controls or the image itself. When I manually advance the slides, and wait for the rotation to automatically resume, it advances to what it would have been had I not manually advanced. Say I am on slide 2 and I advance the slide manually 3 times it goes from slide 5 to slide 3 and up from there. I am not sure if I can place my url as an example or not, but it is mysanantonio.com/businessdev/Christmas_Tree_Lighting_and_Parade.html Otherwise I will submit the html directly -- 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] Change selected option for select tag
Hi, I've an select element that is observed: select id='colors' options value='0'-Select-/select options value='1'Red/select options value='2'Yellow/select /select After that I've processed the form via Ajax and the select was selected in 'Red' for example, I reset the select tag with: Form.Element.setValue('works', '0') This works fine, the select' option is changed, but when I select 'Red' again the change event isn't fired, only works if I select 'Yellow'. I think that the select option value is cached in the browser, please any ideas for this bug? Regards. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Progressive update messages from single request
Hi Joe, It seems to me the simple way to do this is have the first request initiate a process on the server that keeps running when the request completes; the request returns an indicator of the current status and an identifier for the action. Your subsequent requests supply the identifer, which allows the server- side page to check the progress of the ongoing work matching that ID and report back the (new) status. People use things like this for showing progress bars for file uploads without using Flash, that kind of thing. HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote: i think i've seen examples of this, but can't recall where, and could use some guidance. Obviously it's easy to handle a 1:1 Request/Response How can i do a true 1:many process? For instance: Client takes a single action which requires the server to perform 3 tasks: * Query database * Generate PDF * Generate email, attach PDF, and send How can i respond to the client as EACH task is accomplished without ending the request chain? Looking up your data . . . (time-based dots as delay indicator) Creating PDF . . . Email sent (or failed, as the case may be) Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can point me in the right direction (which include samples), i'd be grateful. Thanks. -joe t. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Re: Progressive update messages from single request
I noticed you were using PHP on the server side ... you can also use output buffering to achieve this in one request Alex Mcauley http://www.thevacancymarket.com - Original Message - From: T.J. Crowder t...@crowdersoftware.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Thursday, December 10, 2009 8:38 AM Subject: [Proto-Scripty] Re: Progressive update messages from single request Hi Joe, It seems to me the simple way to do this is have the first request initiate a process on the server that keeps running when the request completes; the request returns an indicator of the current status and an identifier for the action. Your subsequent requests supply the identifer, which allows the server- side page to check the progress of the ongoing work matching that ID and report back the (new) status. People use things like this for showing progress bars for file uploads without using Flash, that kind of thing. HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote: i think i've seen examples of this, but can't recall where, and could use some guidance. Obviously it's easy to handle a 1:1 Request/Response How can i do a true 1:many process? For instance: Client takes a single action which requires the server to perform 3 tasks: * Query database * Generate PDF * Generate email, attach PDF, and send How can i respond to the client as EACH task is accomplished without ending the request chain? Looking up your data . . . (time-based dots as delay indicator) Creating PDF . . . Email sent (or failed, as the case may be) Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can point me in the right direction (which include samples), i'd be grateful. Thanks. -joe t. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group 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: Slideshow: how to maintain current slide between manual adv and auto adv
Hi, Just posting the link requires that everyone trying to help you had to dig through a huge amount of extraneous information to figure out what part of your code is messed up. Here's a more useful approach: http://proto-scripty.wikidot.com/self-contained-test-page From the sound of it, it sounds like your timed-action is written as go to slide 2 (e.g., from slide 1), which assumes that the slide hasn't changed. It seems like it should be written as go to slide current + 1, which should be straightforward enough. FWIW, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 9, 10:41 pm, MakeITRight tony.se...@gmail.com wrote: This is hard to explain in a short subject line. I have a slideshow that is set to auto advance and can be paused and played, but can also be manually advanced or reversed by click on arrow controls or the image itself. When I manually advance the slides, and wait for the rotation to automatically resume, it advances to what it would have been had I not manually advanced. Say I am on slide 2 and I advance the slide manually 3 times it goes from slide 5 to slide 3 and up from there. I am not sure if I can place my url as an example or not, but it is mysanantonio.com/businessdev/Christmas_Tree_Lighting_and_Parade.html Otherwise I will submit the html directly -- 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: Change selected option for select tag
Hi, This works fine, the select' option is changed, but when I select 'Red' again the change event isn't fired, only works if I select 'Yellow'. On what browser(s)? -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Dec 9, 11:10 pm, rdavila ruben.grung...@gmail.com wrote: Hi, I've an select element that is observed: select id='colors' options value='0'-Select-/select options value='1'Red/select options value='2'Yellow/select /select After that I've processed the form via Ajax and the select was selected in 'Red' for example, I reset the select tag with: Form.Element.setValue('works', '0') This works fine, the select' option is changed, but when I select 'Red' again the change event isn't fired, only works if I select 'Yellow'. I think that the select option value is cached in the browser, please any ideas for this bug? Regards. -- 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] A class called Queue()
Hi guys, Firstly I said that I am French. I'll try to speak best in English, be indulgent. I recently developed a class based on Prototype for a application web. I called this class Queue(); This allows you to stack multiple Ajax.Request (or Update) to they are treated to the chain via the onComplete. This allows them allows you to do several things at different times. For example: function fooBar() { MyQueue.add(new Hash({update: 'myDiv', idBhv: 'myBhv', myParams: 'foo' })); MyQueue.add(new Hash({update: 'mySecDiv', idBhv: 'mySecBhv', myParams: 'bar' })); } This function will stack 2 behaviors to be implemented immediately one after the other. I was wondering if this feature would be added in future version of prototype? If yes, I can provide code and ideas. Have fun, See you Cyril Bogaert ( http://www.mental-orb.com/ ) -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Re: Check a mouse button
MouseMove tracks the mouse. A drag for example uses Left Mouse Click (down) plus Mouse Move Click simply detects the click on an element or page.. If you want to observe mousemove into an element then setup an observer once it has entered for click .. this seems a slight waste of time and memory to setup observers ad hoc.. What exactly are you trying to acheive - perhaps one of us can point you in the right direction... Alex Mcauley http://www.thevacancymarket.com - Original Message - From: Frédéric f...@gbiloba.org To: prototype-scriptaculous@googlegroups.com Sent: Thursday, December 10, 2009 8:24 AM Subject: Re: [Proto-Scripty] Re: Check a mouse button Le mercredi 9 décembre 2009 17:35, Frédéric a écrit : I have to check again, but in my previous tests, the isLeftClick() always returned true, and other always returned false... I confirm that isLeftClick() always return true, and isMiddleClick() and isRightClick() always return false... Could it be because I have only one 'mousemove' callback for several elements? -- 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. -- 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: Change selected option for select tag
I've tried in Firefox and Opera and the result is the same. -- Rubén Dávila Santos. http://rubenonrails.com -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Re: Change selected option for select tag
Here's an implementation that works in all the browsers I've checked: var combinator = function(){ $$('select.combo').each(function(elm){ var elm = $(elm); var texts = ['Choose...']; var opts = ['']; var sel = (elm.options[elm.options.selectedIndex].defaultSelected) ? elm.options.selectedIndex : -1; for (var i=0; i elm.options.length; i++) { opts.push(elm.options[i].value); texts.push(elm.options[i].text); }; texts.push('Add new...'); opts.push('Add new...'); elm.options.length = 0; texts.each(function(el,idx){ elm.options[idx] = new Option(el, opts[idx], (idx == 0), false); }); elm.options.selectedIndex = (sel + 1); elm.observe('change',function(evt){ if(this.value == 'Add new...'){ if(!window.bak) window['bak'] = {}; window.bak[this.id] = this; var ti = new Element('input', {type:'text',name:this.name,id:this.id}); this.replace(ti); ti.focus(); ti.observe('blur',function(evt){ if(this.getValue() == '') { this.replace(window.bak[this.id]); $(this.id).options.selectedIndex = 0; } }); } }) }); } I use this to turn select controls into combo boxes, where you can add a value not found in the list by choosing Add new... I believe what you need to look at is whether the selectedIndex is also the defaultSelected. The picker will always show whatever is the selectedIndex, but on a reload, it will show whatever is the defaultSelected. Walter On Dec 10, 2009, at 11:11 AM, Ruben. D. wrote: I've tried in Firefox and Opera and the result is the same. -- Rubén Dávila Santos. http://rubenonrails.com -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en . -- 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: Change selected option for select tag
I think that I've not explained my problem right(due to idiom limitations). My problem is simple: When I reset the select element the onchange element doesn't fire, the workflow is this: I've a select element with 3 elements: -Select-, Red, Yellow 1) When the page load '-Select-' option is the default 2) I select Red, onchange works fine here 3) After that I reset the select(with selectedIndex = 0 or writing the property) 4) Now the option selected is '-Select-' 5) I select 'Red' again, the onchange event doesn't fire 6) when I select 'Yellow' in the previous step the onchange event works fine Thanks. -- Rubén Dávila Santos. http://rubenonrails.com -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Object mashup
Hello I have problem with my Objects. My object have many props and method, one of this is td (screen reprezentation of the object). I observe click event to obj.td where I do many things on this object and change td (screen reprezentation). My question : how find object where is attach clicked td ? Now I setAttribute to td something like obj_id, when td is clicked first I read this attribute from td, find proper object by this id, do what to do and finnaly change state of obj.td. This works fine but when I have very many obj (like thousand), find object takes many time (find object is longer then do what to do). Here is simple example : // example START Event.observe(window, 'load', function() { onLoad(); }); var objTrs = []; var msg = null; function onLoad(){ msg = document.createElement(div); msg.innerHTML = Click on cell; $(document.body).appendChild(msg); var table = document.createElement(table); var tableBody = document.createElement(tbody); table.appendChild(tableBody); $(document.body).appendChild(table); table.border=1 for(var i = 0; i 10; i++){ var myTr = {}; myTr.counter = 0; myTr.tr = document.createElement(tr); myTr.objTds = []; objTrs.push(myTr); for (var j = 0; j 10; j++){ var myTd = {}; myTd.counter = 0; myTd.td = document.createElement(td); myTd.td.setAttribute('tr_id',i); myTd.td.setAttribute('td_id',j); myTd.td.innerHTML = myTr.counter + _ + myTd.counter; myTr.objTds.push(myTd); myTr.tr.appendChild(myTd.td); Event.observe(myTd.td, 'click', function() { // find tr object in array var tr_id = this.getAttribute(tr_id); var myTr = objTrs[tr_id]; myTr.counter++; // find proper td in myTr var td_id = this.getAttribute(td_id); var myTd = myTr.objTds[td_id]; myTd.counter++; var msgTxt = you click + myTr.counter + times on this TR and + myTd.counter + on this TD; myTd.td.innerHTML = myTr.counter + _ + myTd.counter; msg.innerHTML = msgTxt; }); } tableBody.appendChild(myTr.tr); } } // example STOP Best regards maalek -- 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: Check a mouse button
On jeudi 10 décembre 2009, Alex McAuley wrote: MouseMove tracks the mouse. A drag for example uses Left Mouse Click (down) plus Mouse Move Click simply detects the click on an element or page.. If you want to observe mousemove into an element then setup an observer once it has entered for click .. this seems a slight waste of time and memory to setup observers ad hoc.. What exactly are you trying to acheive - perhaps one of us can point you in the right direction... I precisely wants to implement a drag'n'drop feature. I have a set of pictures, displayed in a table as thumbs, and I can move the thumbs in real time using the mouse. For that, I have 3 callbacks: 'mousedown': I start the drag, by storing the src image 'mousemove': I move the thumbs, onlly if the src image has been set 'mouseup': I just reset the src image, so I know that the drag is over But if I release the button outsideany thumbs, the drag remains active, because I can't detect that it ended. There is maybe a better design to do that? -- 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: Change selected option for select tag
Try setting the defaultSelected property as well, that might be getting in the way of your select noticing that it's been changed. yourSelect.options.selectedIndex = 0; yourSelect.options[0].defaultSelected = true; Walter On Dec 10, 2009, at 12:15 PM, Ruben. D. wrote: I think that I've not explained my problem right(due to idiom limitations). My problem is simple: When I reset the select element the onchange element doesn't fire, the workflow is this: I've a select element with 3 elements: -Select-, Red, Yellow 1) When the page load '-Select-' option is the default 2) I select Red, onchange works fine here 3) After that I reset the select(with selectedIndex = 0 or writing the property) 4) Now the option selected is '-Select-' 5) I select 'Red' again, the onchange event doesn't fire 6) when I select 'Yellow' in the previous step the onchange event works fine Thanks. -- Rubén Dávila Santos. http://rubenonrails.com -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en . -- 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: Change selected option for select tag
Very thanks Walter, now it works fine ;) Regards. -- Rubén Dávila Santos. http://rubenonrails.com -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
[Proto-Scripty] Re: Progressive update messages from single request
david: The buffer/flush path seems to be where this solution is heading. Don't ask me why, but iframes rub me the wrong way. With the evolving needs for more streamlined connections, iframes feel like soggy bandaids to me. Given they have a place where nothing else seems to work (Ajax-ish file uploads), but i'd prefer to steer away from them in this case if i can. TJ: That seems like a fairly solid idea. Same general concept of having a second request object checking in on progress that the server reports back, it just gets it from a relatively more reliable source (instead of $_SESSION). Alex: Could you elaborate a bit, or point me to where i can follow up on that? i'm intrigued, but i'm not deeply familiar with using the output buffer effectively. Thanks for the replies! -joe t. On Dec 10, 3:45 am, Alex McAuley webmas...@thecarmarketplace.com wrote: I noticed you were using PHP on the server side ... you can also use output buffering to achieve this in one request Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: T.J. Crowder t...@crowdersoftware.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Thursday, December 10, 2009 8:38 AM Subject: [Proto-Scripty] Re: Progressive update messages from single request Hi Joe, It seems to me the simple way to do this is have the first request initiate a process on the server that keeps running when the request completes; the request returns an indicator of the current status and an identifier for the action. Your subsequent requests supply the identifer, which allows the server- side page to check the progress of the ongoing work matching that ID and report back the (new) status. People use things like this for showing progress bars for file uploads without using Flash, that kind of thing. HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / comwww.crowdersoftware.com On Dec 9, 4:11 pm, joe t. thooke...@gmail.com wrote: i think i've seen examples of this, but can't recall where, and could use some guidance. Obviously it's easy to handle a 1:1 Request/Response How can i do a true 1:many process? For instance: Client takes a single action which requires the server to perform 3 tasks: * Query database * Generate PDF * Generate email, attach PDF, and send How can i respond to the client as EACH task is accomplished without ending the request chain? Looking up your data . . . (time-based dots as delay indicator) Creating PDF . . . Email sent (or failed, as the case may be) Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can point me in the right direction (which include samples), i'd be grateful. Thanks. -joe t. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/prototype-scriptaculous?hl=en. -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptacul...@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
Re: [Proto-Scripty] Re: document.write() vs Element/appendChild()
Why would we add an element using prototype's DOM method over innerhtml in any scenario if we can use innerhtml and subsequently use $(element) to immediately retrieve a reference to it? I was told in the begining that innerhtml was the wrong way. Message sent from my Motorola Droid. On Dec 8, 2009 4:30 PM, david david.brill...@gmail.com wrote: Hi all, I was under the impression that it would not actually be added to the DOM when using innerhtml In fact, it's faster than any JS implementation, prototype or other. Browser are optimize to parse HTML string in an unbeatable way ! And of course it could be manipulate as a DOM element, but you'll have first to retrieve it from DOM using $() or $$(). -- david -- 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 t... 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: document.write() vs Element/appendChild()
I believe that innerhtml is not completely guaranteed to work the same way across browsers, while the Prototype DOM methods are. Walter On Dec 10, 2009, at 10:02 PM, Rob Cluett wrote: Why would we add an element using prototype's DOM method over innerhtml in any scenario if we can use innerhtml and subsequently use $(element) to immediately retrieve a reference to it? I was told in the begining that innerhtml was the wrong way. Message sent from my Motorola Droid. On Dec 8, 2009 4:30 PM, david david.brill...@gmail.com wrote: Hi all, I was under the impression that it would not actually be added to the DOM when using innerhtml In fact, it's faster than any JS implementation, prototype or other. Browser are optimize to parse HTML string in an unbeatable way ! And of course it could be manipulate as a DOM element, but you'll have first to retrieve it from DOM using $() or $$(). -- david -- 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 t... For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en . -- You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com . To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en . -- 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.