Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stevo on Mar 10, 2009 08:27
open dhtmlx forum
[COMBO] Limit only to options from list

Hello - i've browsed through knowledge base but not found complete solution

Requirements

- Combo is blank by default
- By typing in it I would like to filter the list of options (taking into account not only begining of string but whole string). No autocomplete.
- Do not let user leave invalid option in combo (only blank or any option from list allowed). So if user clicks outside of it, it becomes blank if was not selected with valid entry from list.
Answer posted by Alex (support) on Mar 10, 2009 10:02

Hello,

The points 1-2 can be achieved only by using modifying filtering. The modification can be done in the dhtmlxcombo.js, lines 865-873 must be deleted:

/*

  if (filter){
  var text=this.getComboText();
  if (text!=data[1]){
  this.setComboText(data[1]);
  dhtmlXRange(this.DOMelem_input,text.length+1,data[1].length);
  }
  }
  else
  this.setComboText(data[1]);

*/


Regarding the third point - you can set onChange event handler:

combo.attachEvent("onChange",function(){

if(combo.getSelectedValue()!=combo.getActualValue()) combo.setComboText("")

})