Ask AI
Skip to main content

Set 'slide toggle field' as required

Function: Set 'slide toggle field' as required

This action allows you to control whether a "slide toggle" UI element on your application's form must be interacted with by the user before they can proceed. You can also customize the message displayed if the field is left in an invalid state when it's required.

Input

  • UI element (PART - Slide Toggle): The specific slide toggle component on your form that you want to modify. This is a mandatory input.
  • Required (BOOLEAN): Choose True if the slide toggle must be interacted with by the user (e.g., toggled to a specific state). Choose False if the user can leave it as is. This is a mandatory input.
  • Required message (STRING): The custom message that will appear if the user tries to submit the form without properly interacting with this required slide toggle. If left empty, the default message "This field is required" will be used.

Output

None. This action directly modifies the behavior of the specified UI element within your application.

Execution Flow

Real-Life Examples

  • Example 1: Making a consent checkbox mandatory

    • Scenario: On a user registration form, you have a "I agree to the terms and conditions" slide toggle. You want to ensure users explicitly agree before signing up.
    • Inputs:
      • UI element: Consent Toggle (the specific slide toggle component)
      • Required: True
      • Required message: Please agree to the terms and conditions to proceed.
    • Result: The Consent Toggle field will now be marked as mandatory. If a user tries to submit the form without interacting with it, they will see the message "Please agree to the terms and conditions to proceed."
  • Example 2: Making an optional newsletter subscription

    • Scenario: You have a "Subscribe to Newsletter" slide toggle on a profile update page. It was previously mandatory, but now you want to make it optional.
    • Inputs:
      • UI element: Newsletter Subscription Toggle
      • Required: False
      • Required message: (Leave empty, as it's no longer required)
    • Result: The Newsletter Subscription Toggle field will no longer be mandatory. Users can update their profile without interacting with this toggle.
  • Example 3: Re-enabling a default required message

    • Scenario: On an order confirmation page, you have a "Confirm Order Details" slide toggle. It's required, but someone accidentally changed the required message to something unclear. You want to revert to the default message.
    • Inputs:
      • UI element: Confirm Order Details Toggle
      • Required: True
      • Required message: (Leave empty to use the default)
    • Result: The Confirm Order Details Toggle field remains mandatory. If a user tries to submit without confirming, they will now see the default message: "This field is required."