Try replacing ...
Event.observe(this.element, 'keyup',this.elementKeyUpHandler(event));
Event.observe(this.element, 'blur', this.elementBlurHandler(event));
with
this.element
.observe('keyup', this.elementKeyUpHandler.bind(this))
.observe('blur', this.elementBlurHandler.bind(this));
Richard.
On 21/11/2007, xzyfer <[EMAIL PROTECTED]> wrote:
>
> hey all,
>
> i was required to create an auto complete drop down list, a common
> enough thing.
> i got it done soon enough, but decided i wanted to make a generic
> class so that i could attached this behavior to any number of elements
> that access different server side pages/behaviors.
>
> however, in my initialize method, i get the error:
>
> "event is not defined
> Event.observe(this.element, 'keyup',
> this.elementKeyUpHandler(event));"
>
> the class is instantiated from another js file, which uses Event with
> no issue.
>
> i thought the problem could be some sort of class inheritance, but i
> am unsure how to inherit from from prototype, as it is an API not a
> class in it self.
> Then again i could be totally off, which i do suspect!
>
> any help would be great!
>
> here its the class snippet causing the problem:
>
> var AutoComplete = Class.create(
> {
> initialize: function(element)
> {
>
> this.blank = true;
> this.prevInput = "";
> this.element = element;
> this.json = new Hash();
>
> Event.observe(this.element, 'keyup',
> this.elementKeyUpHandler(event));
> Event.observe(this.element, 'blur',
> this.elementBlurHandler(event));
>
> }, ....
> });
> >
>
--
-----
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 "Ruby
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---