ajaxian
#1
Hello,
I’m looking for a dhtmlxForm method that will put the focus on a form field.
I had tried
myForm.setItemFocus("myFieldName");
and several variations of it, but I get a JavaScript error saying the object doesn’t support the method.
Thank you.
ajaxian
#2
Hello, DHTMLX. The courtesy of your reply would be greatly appreciated. Thank you.
alfons
#3
Hi,
Have you tried using the DOM?, I mean something like this:
.
.
.
var formData =
[{type: “input”, name: “usrLogin”, value:"", label:“User:”},
{type: “password”, name: “usrPasswd”, value: “”, label: “Password:”},
{type: “label”, name: “statLogin”,label: “STATUS:”},
{type: “button”, name: “btnLogin”, value: “Login”, command: “sendServer”},
];
var objForm = loginWindow.attachForm(formData);
document.getElementsByName(“usrLogin”).item(0).focus();
objForm.attachEvent(“onButtonClick”, function (name, cmd)
.
.
.
and you’re done. Hope it helps
Andrei
#4
Hello,
Please specify form version?
lucas1
#5
document.getElementsByTagName('input')[0].focus();
or
window.setTimeout(function(){
document.getElementsByTagName('input')[0].focus();
}, 500);
Darya
#6
myForm.setItemFocus(“myItem”);
lucas1
#7
have to wait to load the XML.
not found:
form.setItemFocus('name');
found:
window.setTimeout(function(){
form.setItemFocus('name');
}, 500);
Darya
#8
I see
In this way you need the next:
myForm.loadStruct("xml/form.xml", function(){
form.setItemFocus('name')
});