ComboBox dynamic focus in option list while typing

Hi,



Is there a way to implement the following behavior with the DHTMLXCombobox:



When typing a text into the textbox, the select list is visible underneath it (usually). Typing a text that exactly matches one of the options in the list will select/focus the option. I would like to have the first option focused that would match the partial string of the text that I�m typing. Like this the focus automatically would move to the first best-match element in the list dynamically.



Example: I use the ComboBox as a time-picker. Option list looks like:



00:00

00:15

00:30



23:00

23:15

23:30

23:45



When typing 10 I would like 10:00 to be focused in the list, without filtering all other elements.



Regards,

Christian


Hello,


there is filtering functionality - that allows to filter options by the text in combo inout. Please check the sample: dhtmlx.com/docs/products/dht … ilter.html


Hi,



I know the filtering option.



Filtering removes all option entries not matching the entered text. I would like to keep the whole list and just focus the best first match dynamically, without loosing all other entries.



regards,



Christian


Hello


you can use the following approach that is based on private properties:


combo.attachEvent(“onKeyPressed”,function(key){
var input_text = this.DOMelem_input.value.toLowerCase();
for(var i=0; i<this.optionsArr.length; i++){
var text = this.optionsArr[i].text;
if(text.toString().toLowerCase().indexOf(input_text) == 0){
this.selectOption(i);
break;
}
}
})




Here combo is combo object.


Hi Alex,



I tried your approach, but my combobox text input becomes uneditable. Could you have a look at the attached code example:



<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p> </o:p>



<form action=“/area51/!flex_test” method=“GET” name=“ctest”>
      <select style=‘width:200px;’  id=“combo_zone1” name=“alfa1”>
          <option value=“00:00”>00:00
          <option value=“00:30”>00:30
�<o:p></o:p>



          <option value=“23:00”>23:00
          <option value=“23:30”>23:30
     
      <input type=“submit”/>







regards,<o:p></o:p>




Christian<o:p></o:p>


combotest_temp.html.zip (970 Bytes)


Sorry for the misleading information.


Unfortunately there isn’t a public method to highlight and focus an option without its selection. So, the approach provided before can not be used.


Thanks Alex,



Maybe this would be a nice enhancement for a future build.



regards,



Christian


Christian,


thank you for the idea. Possibly we’ll implement this functionality in one of future builds.