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
Trueif the slide-toggle is 'On', orFalseif 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
EmailNotificationsEnabledwill be created. If the user has the switch turned 'On',EmailNotificationsEnabledwill beTrue. If it's 'Off', it will beFalse. 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
AdvancedFeaturesStatuswill be created. If the slide-toggle is 'On',AdvancedFeaturesStatuswill beTrue, allowing you to display advanced options. If it's 'Off,AdvancedFeaturesStatuswill beFalse`, and you can hide those options.
Example 3: Data Privacy Consent
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
TermsAgreedwill be created. If the user has moved the slide-toggle to 'On',TermsAgreedwill beTrue, indicating consent. If it's 'Off',TermsAgreedwill beFalse, and you can prevent them from completing the registration.