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 Stankov<[email protected]> 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
