Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nerea on Dec 04, 2008 02:16
open dhtmlx forum
onContentLoaded. Focus textbox in a tab

I have the following situation.
I open a windows from the main page.
This windows cotains a tabbar component with textboxs inside a form.

I'd like to focus the first text box using onContentLoaded but it doesn't work when te componet is inside the tabbar beuse it says that the tabbar isn' completely loaded.

Here is my code.

Thanks!

Main:

dhxWins.attachEvent("onContentLoaded", function(win) { //focus en el primer text_box enabled
        win.progressOff();
        if (_isIE && win.getId() == "w1") {                
            win._frame.contentWindow.document.getElementById("txt_Codigo").focus();
        }
    });     

Window:

<div id="a_tabbar" class="dhtmlxTabBar" imgpath="../img/" style="width:482; height:338;margin-left:auto; margin-right:auto;" skinColors="#FCFBFC,#F4F3EE" >
<div id="cli_General" name="General">
<BR>
<FORM name ="frm1">
<P><LABEL class ="labelC">Código:</LABEL><INPUT size="10" type="text" name="txt_Codigo" id="txt_Codigo" maxlength="2" disabled ><BR>
<LABEL class ="labelC">Nombre:</LABEL><INPUT size="48" type="text" name="txt_Nombre" id="txt_Nombre" maxlength="36"><BR>
</FORM>
</div>
</div>
<CENTER>
<BR>
<FORM name ="frm2">
<INPUT type="button" name="bAceptar" onclick="escribir_datos();" value="Aceptar"> <INPUT type="button" name="bCancelar" onclick= "parent.dhxWins.window('w1').close();" value="Cancelar">
</FORM>
Answer posted by Support on Dec 04, 2008 02:47
Your code:

<INPUT size="10" type="text" name="txt_Codigo" id="txt_Codigo" maxlength="2" disabled >

Input is disabled so cannot be in focus.
Answer posted by Nerea on Dec 04, 2008 03:18

I have a function which change the state to enabled. It depends if it is new, open or delete.

But same thing happens with txt_Nombre which is allways enabled.

Answer posted by Support on Dec 04, 2008 05:42
All works fine. Here is a demo.

(input enabled, launch attach_url2.html file)
Attachments (1)
demo.zip1.11 Kb