Autoselect text


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


Use the next approach:

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

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?


You can add also:

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