Get value of radiobutton field
Function: Get value of radiobutton field
This function helps you retrieve the specific choice a user has made from a "Radio Button" selection on your application's screen. It captures the unique identifier (code) associated with the selected option and saves it into a variable, so you can use this information in other parts of your application, like showing different content or performing calculations.
Input
- UI element (PART): This is the specific Radio Button component on your application's screen from which you want to get the user's selection. It's crucial that you select a UI element that is configured as a "radiobutton-field".
Output
- Answer (STRING): This is the name of the variable where the unique code of the user's selected radio button option will be stored. By default, this variable will be named
RADIOBUTTON_FIELD_ANSWER, but you can choose a more descriptive name if you wish.
Execution Flow
Real-Life Examples
Example 1: Capturing a Customer's Preferred Contact Method
- Scenario: You have a customer feedback form where users select their preferred contact method (Email, Phone, SMS) using radio buttons. You want to save this choice to determine how to follow up.
- Inputs:
- UI element:
Preferred Contact Method Radio Buttons(a UI element of typeradiobutton-fieldwith options like "EMAIL", "PHONE", "SMS"). - Answer:
customerContactPreference
- UI element:
- Result: The variable
customerContactPreferencewill store the unique code of the selected option (e.g., "EMAIL", "PHONE", or "SMS"). You can then use this variable to send an email, make a call, or send an SMS.
Example 2: Dynamically Displaying Shipping Options Based on Delivery Speed
- Scenario: On an e-commerce checkout page, customers choose their desired delivery speed (Standard, Express, Overnight) via radio buttons. Based on their choice, you want to show different shipping cost estimates.
- Inputs:
- UI element:
Delivery Speed Options(a UI element of typeradiobutton-fieldwith options like "STANDARD", "EXPRESS", "OVERNIGHT"). - Answer:
selectedDeliverySpeed
- UI element:
- Result: The variable
selectedDeliverySpeedwill hold the code for the chosen delivery speed (e.g., "STANDARD"). You can then use a conditional action (e.g., "IfselectedDeliverySpeedis 'EXPRESS', then show Express Shipping Cost") to display the relevant information.
Example 3: Recording User Consent for Terms and Conditions
- Scenario: Before a user can complete a registration, they must agree to the Terms and Conditions. You use a radio button field with "Yes" and "No" options to capture their consent.
- Inputs:
- UI element:
Agree to Terms Radio Button(a UI element of typeradiobutton-fieldwith options "YES" and "NO"). - Answer:
userAgreesToTerms
- UI element:
- Result: The variable
userAgreesToTermswill store "YES" if the user agreed, or "NO" if they didn't. This variable can then be used to enable or disable the "Submit" button or trigger an error message if "NO" is selected.