Ask AI
Skip to main content

Get value of slide-toggle field

Function: Get value of slide-toggle field

This action helps you find out if a 'slide-toggle' switch on your application's screen is currently turned 'On' or 'Off'. It retrieves the current state of the switch and stores it in a variable for you to use in other parts of your application's logic.

Input

  • UI element (PART): This is the specific slide-toggle switch on your application's screen that you want to check. You must select a UI element that is of the 'slide-toggle' type.
  • Answer (BOOLEAN): This is the name of the variable where the 'On' (True) or 'Off' (False) status of the slide-toggle will be stored. If you don't provide a name, it will default to SLIDE_TOGGLE_FIELD_ANSWER.

Output

  • Answer (BOOLEAN): A variable containing True if the slide-toggle is 'On', or False if it's 'Off'.

Execution Flow

Real-Life Examples

Example 1: Check Notification Preference

Imagine you have a user profile page where users can decide if they want to receive email notifications.

  • Inputs:
    • UI element: Select the 'Receive Email Notifications' slide-toggle switch on the profile page.
    • Answer: EmailNotificationsEnabled
  • Result: A variable named EmailNotificationsEnabled will be created. If the user has the switch turned 'On', EmailNotificationsEnabled will be True. If it's 'Off', it will be False. You can then use this variable to decide whether to send them an email.

Example 2: Control Feature Access

Suppose your application has an "Enable Advanced Features" slide-toggle. You want to show or hide certain options based on its state.

  • Inputs:
    • UI element: Select the 'Enable Advanced Features' slide-toggle.
    • Answer: AdvancedFeaturesStatus
  • Result: A variable named AdvancedFeaturesStatus will be created. If the slide-toggle is 'On', AdvancedFeaturesStatus will be True, allowing you to display advanced options. If it's 'Off, AdvancedFeaturesStatuswill beFalse`, and you can hide those options.

When a user signs up, they might have a slide-toggle to agree to terms and conditions. You need to know if they've given consent before proceeding.

  • Inputs:
    • UI element: Select the 'Agree to Terms and Conditions' slide-toggle.
    • Answer: TermsAgreed
  • Result: A variable named TermsAgreed will be created. If the user has moved the slide-toggle to 'On', TermsAgreed will be True, indicating consent. If it's 'Off', TermsAgreed will be False, and you can prevent them from completing the registration.