Ask AI
Skip to main content

Get value of slide-toggle field

Function: Get value of slide-toggle field

This action allows you to retrieve the current state (whether it's "On" or "Off") of a specific slide-toggle component on your application's form. Once retrieved, this True/False value is stored in a variable, making it available for other actions or logic within your application.

Input

  • UI element
    • Description: This is the specific slide-toggle component on your form whose current state you want to capture. You must select a UI element that is of the "slide-toggle" type.
    • Type: UI element (specifically a slide-toggle)
    • Required: Yes

Output

  • Answer
    • Description: This is the name of the variable where the True/False state of the slide-toggle will be stored. If the slide-toggle is "On," the variable will hold True; if it's "Off," it will hold False.
    • Type: True/False value (Boolean)
    • Default Value: SLIDE_TOGGLE_FIELD_ANSWER

Execution Flow

Real-Life Examples

Example 1: Capturing User Preferences

Imagine you have a user profile form where users can choose to receive email notifications using a slide-toggle. You want to save this preference.

  • Inputs:
    • UI element: Select the "Email Notifications" slide-toggle component from your form.
    • Answer: (Leave as default) SLIDE_TOGGLE_FIELD_ANSWER
  • Result: If the user has the "Email Notifications" toggle set to "On," the variable SLIDE_TOGGLE_FIELD_ANSWER will store True. If it's "Off," it will store False. You can then use this variable to update the user's profile in your database.

Example 2: Conditional Form Submission

You have a registration form with a "Agree to Terms and Conditions" slide-toggle. You want to ensure the user has agreed before allowing them to submit the form.

  • Inputs:
    • UI element: Select the "Agree to Terms and Conditions" slide-toggle component.
    • Answer: UserAgreedToTerms
  • Result: The variable UserAgreedToTerms will store True if the user has toggled "On" to agree, or False if they haven't. You can then add a condition to your "Submit" button's logic: "If UserAgreedToTerms is True, then enable the Submit button."

Example 3: Controlling Feature Visibility

Your application has a "Dark Mode" feature controlled by a slide-toggle in the settings. You want to apply the dark mode theme if the toggle is "On."

  • Inputs:
    • UI element: Select the "Enable Dark Mode" slide-toggle component.
    • Answer: IsDarkModeEnabled
  • Result: The variable IsDarkModeEnabled will store True if the user has turned "On" dark mode, or False if it's "Off." You can then use this variable in a conditional action to apply a "dark-theme" style to your application's pages if IsDarkModeEnabled is True.