How do I auto-select/auto-focus a section when I click an UI Action or onSubmit C/S?

salvadormarchan
Kilo Guru

Hi,

How do I auto-select/auto-focus a section when I click an UI Action or onSubmit client script?

I have tried using focus() and select() on the target field but it is not showing when the section form is not selected.

Please help....

Thanks,

Dor

1 ACCEPTED SOLUTION

Slava Savitsky
Giga Sage

To switch to a particular form section (tab), use the following client-side code:



g_tabs2Sections.setActive(X);



where X is the number of the section (tab).



For more information on how to deal with form tabs in scripts, have a look at this blog post:


Demystifying form tabs | SNOWman's Blog


View solution in original post

7 REPLIES 7

You can use the following code to find out the number of a form section by the name of a field in that section:



g_tabs2Sections.findTabIndex('field_name');


This is the helpful function, this one right here.

Thanks a lot, Slava! You saved my day today.

 

So people, in other words, here is the entire instruction you can use to get the focus on a desired section where there is a specific field:

g_tabs2Sections.setActive(g_tabs2Sections.findTabIndex('field_name'));

Andrew Bettcher
Kilo Sage

Amazing. It isn't often that that first page I find on a Google search yields a result that is directly applicable and works with very little amendment.

 

Thank you.