how to set initial focus

Hi.
I cant get focus to be set on my form item. Item (where I want focus on) code is:

"<item type='input' name='username' label='Username:' style='text-transform:uppercase' focus='true' value='$SIFRA'/>"

My form:

...
dhxFormAgent.loadStruct('data_xml/agent_podaci_xml.php);
dhxFormAgent.focus();
...

Is there something more I need to do so I can have focus on my ‘input’.
Allso how can I set focus on some element from function (I mean programaticaly)?
Thanks

hi

  1. load() used async request, you need: myForm.load(“url”, function(){ /*code here */ })

  2. some funcs:
    docs.dhtmlx.com/doku.php?id=dhtm … irstactive
    docs.dhtmlx.com/doku.php?id=dhtm … titemfocus

please read documentation before you will ask next time :wink:

Hi Andrei, thanks for your help.
My form loads just fine from xml file (my posted code is only a small portion), only thing that is missing is focus on first(some) control. From your on-line documentation I found out I need to provide ‘focus’ atribute and set it to ‘true’ to have focus on that control upon form loading. This is not happening, so I ask. Sorry if this is troublle for you. dhxFormAgent.setFocusOnFirstActive(); isn’t working also.

Please provide completed demo or direct link to check issue?