Set focus

Hi,



Can I set focus for the combobox by javascript/script such as setTimeout(…?



How can I get back the header textbox by

document.getElementsByName("…") / document.getElementByID("…") to set .focus()??



Thanks.

If you have combobox object
    var c = new   dhtmlXCombo( …

You can focus cell by

    c.DOMelem_input.focus();


Or if you have specific form name
    var c = new   dhtmlXCombo(“my_div”,“input_name”);
you can focus by such name as
    document.getElementsByName(“input_name”)[0].previousSibling.focus();


Hi,



Thanks for ypur answer but it seems that is does not work for   



var c =dhtmlXComboFromSelect (“c”,“c_text”);



The combobox will disappear. (I think it should be error.)



 



However, I view the codes and find the line 1080 can set the id for the simulate combobox. Thanks a lot.


I am also facing the same problem, but looking the suggested solution as being:



document.getElementsByName(“input_name”)[0].previousSibling.focus();



 



is way too complicated to do or put in our code. We aim at making our code simple and readable without the need to do deep div in DOM programing.



Since this has a common usage I think it should be an API call to XCombo.



 



Daniel



 


By the way, what is this:



var c = new   dhtmlXCombo(“my_div”,“input_name”);




I can’t see this type of object intitialization in the documentation. Instead what we have is  something like this:



var c = new   dhtmlXCombo(“my_div”,“alpha2”, 200);



 which I don’t know what alpha2~4 is all about?



Daniel


but it seems that is does not work for  

Actually, in case of using document.getElementsByName(“input_name”)[0].previousSibling.focus(); approach there can be an issue in IE (in FF all works correctly) - IE cann’t find an element which was created dynamically.

So, please, try to use the following approach:

    c.DOMelem_input.focus();

If problem persists, please, provide sample directly to  support@dhtmlx.com.