Operating Combobox

  1. To show/hide a combobox use the methods show() and hide(), respectively:
    myCombo.show(mode);
  2. To enable/disable the readonly mode the method readonly() is used:
    myCombo.readonly(mode);
  3. To enable/disable a combobox use the corresponding methods:enable() and disable()
    myCombo.disable(mode);

Accessing combo elements

You can access the input element of the combo as combo.DOMelem_input. Direct access to the element allows assigning custom event handlers. The next code for example limits input in combo, allowing only digits:

dhtmlxEvent(combo.DOMelem_input, "keypress", function(e){
    e = e||event;
    var code = e.which||e.keyCode;
    if (code >=48 && code < 58) return true;
 
    e.cancelBubble=true;
    if (e.preventDefault) e.preventDefault();
    return false;
});
Back to top