bigral
2008-Jan-03 12:51 UTC
how to extend existing methods functionality in scriptaculous
Hello All, I''m new to javascript and scriptaculous so I wanted to ask gurus about CORRECT way of extending already existing methods. Here is my example: we have: Autocompleter.updateElement() { ... if (this.options.afterUpdateElement) this.options.afterUpdateElement(this.element, selectedElement); } Let''s say I want to "submit form" right after user select new value in Autocompleter field. What the CORRECT way to accomplish that? I need to make something similar to: function newAfterUpdateElement() { .... <do my actions here>... return this.oldAfterUpdateElement(); } Autocompleter.prototype.options.oldAfterUpdateElement=Autocompleter.prototype.options.afterUpdateElement; Autocompleter.prototype.options.afterUpdateElement=newAfterUpdateElement; thanks, bigral --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---