[Proto-Scripty] Re: onchange event delegation on IE
Hi Radoslav, Thanks for reply, I have indeed did something very similar to this, just some different terminology plus i have wrapped the Form.Element.setValue method to fire 'value:changed' event too. You might wanna do that too if you are initializing your form elements with some default values or setting values programatically :) cheers -- mona On Tue, Sep 1, 2009 at 7:52 PM, Radoslav Stankovrstan...@gmail.com wrote: hm, I have similar problem (in my case I was adding / removing a lot of inputs dynamically). And using Form.Observer / Element.observe would have been an small maintenance hell. So I have been using 2 custom events - focus:in / focus:out, for bubbling focus/blur. http://gist.github.com/162593 You could you same approach to emulate onchange, or event use something like this, for inputs ( I'm using my Event.delegate http://gist.github.com/66568 ) document.delegate('input[type=text]', 'focus:in', function(){ this.store('value', this.getValue()); }); document.delegate('input[type=text]', 'focus:out', function(){ if (this.retrieve('value') != this.getValue()) this.fire ('value:changed', { previousValue: this.retrieve('value'); }); }); document.delegate('input[type=text]', 'value:changed', function(){ // ... some cool code here }); Hope this will be helpfull --~--~-~--~~~---~--~~ 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: onchange event delegation on IE
hm, I have similar problem (in my case I was adding / removing a lot of inputs dynamically). And using Form.Observer / Element.observe would have been an small maintenance hell. So I have been using 2 custom events - focus:in / focus:out, for bubbling focus/blur. http://gist.github.com/162593 You could you same approach to emulate onchange, or event use something like this, for inputs ( I'm using my Event.delegate http://gist.github.com/66568 ) document.delegate('input[type=text]', 'focus:in', function(){ this.store('value', this.getValue()); }); document.delegate('input[type=text]', 'focus:out', function(){ if (this.retrieve('value') != this.getValue()) this.fire ('value:changed', { previousValue: this.retrieve('value'); }); }); document.delegate('input[type=text]', 'value:changed', function(){ // ... some cool code here }); Hope this will be helpfull --~--~-~--~~~---~--~~ 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: onchange event delegation on IE
Hi Mona, Have you considered using Form.Observer[1] instead of events? [1] http://prototypejs.org/api/timedObserver/form-observer -- T.J. Crowder tj / crowder software / com www.crowdersoftware.com On Aug 31, 10:07 am, Mona Remlawi mona.reml...@gmail.com wrote: Hello Prototypers, I am currently in the process of implementing events delegation on HTML forms. As you might know, IE does not bubble the onchange event :( and i find that the onblur is a poor and a high maintenance alternative. Can anyone propose a neater solution? The forms i'm delegating events on have repeatable sections, so that's why i would insist on delegation. Thanks in advance cheers -- mona --~--~-~--~~~---~--~~ 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: onchange event delegation on IE
oh that would be a big overhead for me as the forms i'm talking about can grow to have 100s of inputs. so serializing to detect changes doesn't seem to be a good idea, neither having TimedObservers on Form.Element level. guess my best option is to set the onchange attribute on input elements to trigger some custom event input onchange=Element.fire(this, 'form:change') / then capture this event on the form object .. argh i can't believe how much time we spend on IE hacks and workarounds. cheers -- mona On Mon, Aug 31, 2009 at 12:45 PM, T.J. Crowdert...@crowdersoftware.com wrote: Hi Mona, Have you considered using Form.Observer[1] instead of events? [1] http://prototypejs.org/api/timedObserver/form-observer -- T.J. Crowder tj / crowder software / com www.crowdersoftware.com On Aug 31, 10:07 am, Mona Remlawi mona.reml...@gmail.com wrote: Hello Prototypers, I am currently in the process of implementing events delegation on HTML forms. As you might know, IE does not bubble the onchange event :( and i find that the onblur is a poor and a high maintenance alternative. Can anyone propose a neater solution? The forms i'm delegating events on have repeatable sections, so that's why i would insist on delegation. Thanks in advance cheers -- mona --~--~-~--~~~---~--~~ 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: onchange event delegation on IE
None of my business... but you're certainly doing something wrong UI- wise if you have 100s of inputs on the same page. Best, Tobie On Aug 31, 1:15 pm, Mona Remlawi mona.reml...@gmail.com wrote: oh that would be a big overhead for me as the forms i'm talking about can grow to have 100s of inputs. so serializing to detect changes doesn't seem to be a good idea, neither having TimedObservers on Form.Element level. guess my best option is to set the onchange attribute on input elements to trigger some custom event input onchange=Element.fire(this, 'form:change') / then capture this event on the form object .. argh i can't believe how much time we spend on IE hacks and workarounds. cheers -- mona On Mon, Aug 31, 2009 at 12:45 PM, T.J. Crowdert...@crowdersoftware.com wrote: Hi Mona, Have you considered using Form.Observer[1] instead of events? [1]http://prototypejs.org/api/timedObserver/form-observer -- T.J. Crowder tj / crowder software / com www.crowdersoftware.com On Aug 31, 10:07 am, Mona Remlawi mona.reml...@gmail.com wrote: Hello Prototypers, I am currently in the process of implementing events delegation on HTML forms. As you might know, IE does not bubble the onchange event :( and i find that the onblur is a poor and a high maintenance alternative. Can anyone propose a neater solution? The forms i'm delegating events on have repeatable sections, so that's why i would insist on delegation. Thanks in advance cheers -- mona --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---