May 22, 2008, 09:49 AM
seadogSetting focus on a specific field on a screen
I am selecting a button from frm1 and executing a function to add records to a db. I want to put the cursor back on the first text box on frm1 upon returning from the called function.
May 22, 2008, 10:06 AM
GamPYou can do that by setting the tab order of the fields in the form so that this text field is the first in the lsit.
An alternative method would be to include a small javascript code that does that.
May 22, 2008, 03:59 PM
seadogThe tab order process does not accomplish the task. I have it set that way now.
May 23, 2008, 10:09 AM
smithsHave you tried the Javascript function call:
document.frm1.firstFieldName.focus()
Sean
May 26, 2008, 02:14 AM
<Shyam L>In the window_onload() function use
document.formname.fieldname.focus() as Sean said
or in case you are not using Form tag then use
fieldname.focus(). Your tab order will also work once you do this.
May 27, 2008, 10:14 AM
seadogShyam,
Where is the window_onload function? I do not find it in the Events tab for any of the forms I have created.
I tried your command on the "open" event function and Maintain returned an error code.
My form name is frm_update with a field name of acronym_name_Edit.
May 27, 2008, 03:09 PM
seadogMaintain Wizard resolved the issue with the following command:
Winform Set frmname.field_name_Edit.Focus to Here