Get template ui element by code
Function: Get template UI element by code
This action allows you to retrieve a specific UI element from your current template by using its unique code. This is useful when you need to dynamically access or manipulate a part of your template, such as updating its content or visibility based on user interactions or data.
Input
- Code: (Text) The unique identifier for the UI element you want to find within your template. This input is required.
Output
- UI element: (UI element) The retrieved UI element will be stored in a variable with this name. By default, it will be named
TEMPLATE_COMPONENT, but you can change it to a more descriptive name if needed. This output is required.
Execution Flow
Real-Life Examples
-
Example: Dynamically showing a welcome message
- Scenario: You have a welcome message UI element (
welcomeMessage) in your template that should only appear if a user is logged in. You need to retrieve this element to change its visibility. - Inputs:
- Code:
welcomeMessage
- Code:
- Result: The
welcomeMessageUI element is retrieved and stored in a variable namedTEMPLATE_COMPONENT. You can then use another action to set its visibility totrueif the user is logged in.
- Scenario: You have a welcome message UI element (
-
Example: Updating a product description field
- Scenario: On a product detail page, you want to update the text content of a specific product description field (
productDescriptionText) after fetching new data from a database. - Inputs:
- Code:
productDescriptionText
- Code:
- Result: The
productDescriptionTextUI element is retrieved and stored in a variable namedTEMPLATE_COMPONENT. You can then use another action to update its text content with the new product description.
- Scenario: On a product detail page, you want to update the text content of a specific product description field (
-
Example: Highlighting an active navigation item
- Scenario: You have a navigation menu where each item has a unique code (e.g.,
navHome,navAbout,navContact). When a user clicks on a menu item, you want to retrieve that specific item and apply a "highlighted" style. - Inputs:
- Code:
navAbout(assuming the user clicked the "About" link)
- Code:
- Result: The
navAboutUI element is retrieved and stored in a variable namedTEMPLATE_COMPONENT. You can then use another action to add a CSS class or change its properties to highlight it.
- Scenario: You have a navigation menu where each item has a unique code (e.g.,