Autoselect text

Hi

How can I select all the text in a combo box when it receives focus?

Thanks

Hi
Use the next approach:

myForm = new dhtmlXForm("form1", formData); cmb = myForm.getCombo("color_combo"); myForm.attachEvent("onFocus", function(name, value){ if(name == "color_combo"){ cmb.DOMelem_input.select(); } });

Thank you Darya

It didn’t quite accomplish what I wanted to though.
After the combo box opens it takes the selection away again.

I have a combo in a form (so I have both’s events to work with), and what my intention is to have all text selected when the combo box is clicked.
I have filtering enabled, so the user would then start typing straight away because the text is selected.
I have tried the onOpen event but no success.

Do you have any ideas?

Regards

You can add also:

cmb.attachEvent("onSelectionChange", function(){ cmb.DOMelem_input.select(); });