logic.js: Passing constructor references to event handler
Content
I have the following code that I'm trying to use:
Custom.Widgets.test.foo = RightNow.Widgets.extend({
constructor: function() {
this._textElement = this.Y.one(this.baseSelector);
if (this._textElement)
{
this._textElement.on("change", this._onChange, this);
}
},
_onChange: function(evt)
{
var textBoxValue = this._textElement.value; // throws undefined error
// how do I access the text textbox value here without using a global variable
}
});
I understand that inside "_onChange", the scope of "this" changes. But is there a way I can maintain the constructor's scope too inside the event handler?
PS: I'm aware of the alternative of using a global variable and then assigning it to "
0