I have a simple form…
searchForm: [
{ type:"settings",position: "label-left",labelWidth:110, labelAlign:"right", inputWidth:200 },
{ type:"input", name:"dwgno", id:"dwgno", label:"Drawing Number", offsetTop:10 },
{ type:"input", name:"insight", id:"insight", label:"Insight Search", info:true },
{ type: "block", offsetLeft:90,
list:[
{ type:"button", name:"searchbtn", value:"Search" },
{ type:"newcolumn" },
{ type:"button", name:"clearbtn", value:"Clear" }
]},
],
When the page appears I want to put focus in the first field. Sounds simple, right? Should be, but I don’t know what I’m missing. I attached the form this way…
myForm = cx.layout.cells("a").attachForm(searchForm);
This is everything I have tried so far…
[code]/Placing this right after the .attachForm() call/
myForm.setFocusOnFirstActive();
/This way doesn’t work because of timing, need a callback so it happens AFTER the form is completely drawn/
/This won’t work for me because this way only works for loading a form from a url/
myForm.loadStruct(“link here”, function(){
myForm.setFocusOnFirstActive();
)};
/This won’t work for me because this way requires the form to be in XML format/
myForm.loadStructString(searchForm, function(){
myForm.setFocusOnFirstActive();
});[/code]
It’d be great if they just gave .attachForm() a callback function because I think the problem is that it’s trying to focus before the form is completely drawn. So how do I accomplish this with a form defined in JSON???
Thanks!