--- title: "Set focus to element" slug: "freaction-set-focus" updated: 2026-05-05T11:54:43Z published: 2026-05-05T11:54:43Z canonical: "docs.lobstersoftware.com/freaction-set-focus" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # Set focus to element *See also:* [Set focus to next element](/v1/docs/en/freaction-focus-next), [Set focus to previous element](/v1/docs/en/freaction-focus-prev) > [!NOTE] > **Actions – Abstract** > > The action [Set focus to element](/v1/docs/en/freaction-set-focus) transfers the focus within a form – as far as technically possible – to the linked **Target element**. ![images/download/attachments/189433447/image-2024-10-9_11-56-5-version-1-modificationdate-1728467765738-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-10-9_11-56-5-version-1-modificationdate-1728467765738-api-v2.png) The action [Set focus to element](/v1/docs/en/freaction-set-focus) transfers the focus within a form – as far as technically possible – to the linked **Target element**. - If no target element is linked, then the *executing element* is considered the target element. **NOTE:** The action can only be executed if an element is already linked. However, the link can then be removed. - If a target element is linked, the focus is transferred to the target element. If this fails, the focus remains unchanged. The **Target element** must meet the following criteria in order to be focused: - The element must be of a type that is focusable. An [Image/Icon](/v1/docs/en/fre-image-vo) cannot do this, e.g. while a [Button](/v1/docs/en/fre-button-vo) can be focused. - The element must be "active" and "visible". This is the case, if the options "Active" and "Visible" are set for the element itself as well as all of its parent containers. - The element must not have become "active" ([Enable element](/v1/docs/en/freaction-enable)) and/or "visible" ([Show element](/v1/docs/en/freaction-show)) by other actions in the same behavior that sets the focus (see example below). > [!NOTE] > **NOTE:** > > - In contrast to the actions [Set focus to next element](/v1/docs/en/freaction-focus-next) and [Set focus to previous element](/v1/docs/en/freaction-focus-prev), a target element becomes focusable even if it is considered "read-only", i.e. the option "Read only" is set for the element itself or one of its parent containers. > - If the target element is located in a partially accessible area of the form (in a [Tab panel](/v1/docs/en/fre-tab-panel-vo) or [Expandable](/v1/docs/en/fre-expandable-vo) element), this area is made completely visible by the action [Set focus to element](/v1/docs/en/freaction-set-focus). This is done regardless of whether the target element can actually accept the focus, i.e. even if it is not "active" and/or not "visible" (see example below). ## Example An input form for [Shipments](/v1/docs/en/shp-shipment) provides a [Tab panel](/v1/docs/en/fre-tab-panel-vo) element for the input of shipment details in groups (per tab). While information on **Pickup** and **Destination** is mandatory, the **Transport** and **Dangerous goods** tabs are initially hidden. They should only appear if the user clicks a [Button](/v1/docs/en/fre-button-vo) in the **Destination** tab. The respective button not only makes the tab visible, but also selects it immediately. ![images/download/attachments/189433447/image2020-5-5_19-26-35-version-1-modificationdate-1728465330852-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2020-5-5_19-26-35-version-1-modificationdate-1728465330852-api-v2.png) Configuration: Only the configuration for the **Continue with "Transport"** [Button](/v1/docs/en/fre-button-vo) is presented here, to demonstrate the possible uses for the action [Set focus to element](/v1/docs/en/freaction-set-focus). | ![images/download/attachments/189433447/image-2024-10-9_12-2-25-version-1-modificationdate-1728468144880-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-10-9_12-2-25-version-1-modificationdate-1728468144880-api-v2.png) | When clicking on the **Continue with "Transport"** [Button](/v1/docs/en/fre-button-vo), the behavior "show tab" is called first, which will not be presented in detail here. - The action [Show element](/v1/docs/en/freaction-show) for the **Transport** tab is executed if all mandatory fields for **Pickup** and **Destination** contain valid data. - Afterwards, the action [Execute behavior](/v1/docs/en/freaction-execute-behaviour) calls the second behavior of the "set focus" button. --- The behaviour "set focus" does not use a custom **Triggering event**, because it should only be called by [Execute behavior](/v1/docs/en/freaction-execute-behaviour) in the "show tab". Under **Execute later once (ms)**, a small time delay of 10 milliseconds is defined. This ensures that the **Transport** tab, which has just been defined as visible by calling the behavior "show tab", and the [Form elements](/v1/docs/en/fre-form-elements) it contains, are processed by the browser so that the focus can be set within the tab in the next step. --- The **Behavior type** [Static](/v1/docs/en/frebehav-static) determines via the preset default value "ON" (or "True") that the **Actions on "true"** are always executed. --- Under the focusable **Actions on "true"**, the [Set focus to element](/v1/docs/en/freaction-set-focus) action is called: - As a target element, a [Image/Icon](/v1/docs/en/fre-image-vo) ("Mode of transport") was linked here, which is located in the expandable area of an [Expandable](/v1/docs/en/fre-expandable-vo) element. - The target element for the screenshot was selected in the form designer (red frame): ![images/download/attachments/189433447/image2020-5-5_19-28-32-version-1-modificationdate-1728465330857-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2020-5-5_19-28-32-version-1-modificationdate-1728465330857-api-v2.png) | | --- | --- | Appearance during runtime: | Before clicking on "Continue with Transport" | After clicking on "Continue with Transport" | | --- | --- | | ![images/download/attachments/189433447/image2020-5-5_19-29-24-version-1-modificationdate-1728465330894-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2020-5-5_19-29-24-version-1-modificationdate-1728465330894-api-v2.png) | ![images/download/attachments/189433447/image2020-5-5_19-30-59-version-1-modificationdate-1728465330901-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2020-5-5_19-30-59-version-1-modificationdate-1728465330901-api-v2.png) - The **Transport** tab is displayed as "visible" for the first time. - Although the target element cannot have a focus as a [Image/Icon](/v1/docs/en/fre-image-vo), the surrounding **Transport** tab is selected by the action [Set focus to element](/v1/docs/en/freaction-set-focus). | | **After closing the expandable area** | | ![images/download/attachments/189433447/image2020-5-5_19-31-34-version-1-modificationdate-1728465330903-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2020-5-5_19-31-34-version-1-modificationdate-1728465330903-api-v2.png) | | **Before clicking on "Continue with Transport" again** | **After clicking on "Continue with Transport" again** | | ![images/download/attachments/189433447/image2020-5-5_19-32-6-version-1-modificationdate-1728465330906-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2020-5-5_19-32-6-version-1-modificationdate-1728465330906-api-v2.png) | ![images/download/attachments/189433447/image2020-5-5_19-30-59-version-1-modificationdate-1728465330901-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2020-5-5_19-30-59-version-1-modificationdate-1728465330901-api-v2.png) - The result shows that the action [Set focus to element](/v1/docs/en/freaction-set-focus) for the [Image/Icon](/v1/docs/en/fre-image-vo) not only selects the surrounding tab, but also expands the collapsed area of the [Expandable](/v1/docs/en/fre-expandable-vo) element, in which it is contained. |