Toolbar Input onKeyPress Custom Event Handler

Hi,



I have a form with input fields created using dhtmlxToolbar.I would like to implement AutoComplete feature in the input fields.However the toolbar events only support the onEnter and the onClick implementations.



How do I write a custom event handler for onKeyPress or autocomplete feature on the toolbar object? I would like to trigger a event as soon as the user starts typing in the input fields of the toolbar.





Regards,



Vikram

Hello,

Edit the dhtmlxtoolbar.js file:

dhtmlXToolbarObject.prototype._buttonInputObject = function(that, id, data, pos) {
    …
    // add custom code
    this.obj.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].onkeypress = function(e) {
        e = e||event;
        th.callEvent(“onKeyPress”, [self.obj.idd, this.value, e.keyCode]);
    }
}

This will fire “onKeyPress” event and pass input’s id, value and key code to handler

You cann add handler to main html code like this:

var toolbar = new dhtmlXToolbarObject(…);
toolbar.attachEvent(“onKeyPress”, function(id, value, key){
    …
});