JavaScript

{dialog.object}setFocus Method

Syntax

{dialog.object}.setFocus(controlName);

{dialog.object}.setFocus(controlName, repeatingSectionRowNumber);

Arguments

controlNameString

The control to set focus on.

repeatingSectionRowNumberNumber

Logical row number, must be specified if using a repeating section control.

Description

Sets focus to a specified control on the dialog.

If the control is inside a tab or accordion, gives focus to the appropriate tab/accordion pane. If the control is in a Repeating Section, you must also specify the logical row number.

Example 

// set focus to the LASTNAME control
{dialog.object}.setFocus('LASTNAME');

// set focus to the QUANTITY control in the 4th row of the repeating section:
{dialog.object}.setFocus('QUANTITY',4);

Javascript Controls 

The setFocus() Method works for Javascript controls (such as the List control) as well as HTML controls (such as a checkbox, textbox, etc). The motivation for adding support for Javascript controls to the .setFocus() method was to enable the following use case:

Assume you have a UX component with a List control on one Panel and some other controls on another Panel. The second Panel has a button that returns focus to the first Panel. However, when focus returns to the first Panel, pressing up and down keys (when running on a desktop browser) did not navigate in the List (even though visually, the List appeared to have focus). By using the .setFocus() method in the event handler for the button that returns focus to the first Panel, you can solve this problem.

See Also