Set radiobutton field as required
Function: Set radiobutton field as required
This function allows you to control whether a specific radio button field on your form must be filled out by the user before they can proceed. You can also customize the message shown if the field is left empty when required.
Input
- UI element (PART - Radiobutton Field): The specific radio button field on your form that you want to modify. This is a required input.
- Required (BOOLEAN): Choose 'True' if the radio button field should be mandatory, or 'False' if it's optional. If you leave this blank, the field's current required setting will remain unchanged.
- Required message (STRING): The custom message that will appear next to the radio button field if the user tries to submit the form without making a selection when it's set as required. If left empty, a default message will be used.
Output
This function does not produce any direct output. Instead, it modifies the behavior and appearance of the specified radio button field directly on your form.
Execution Flow
Real-Life Examples
Here are some examples of how you can use the "Set radiobutton field as required" function:
Example 1: Make a "Payment Method" field mandatory with a custom message.
- Inputs:
- UI element:
Payment Method(a radio button field on your checkout form) - Required:
True - Required message:
Please select a payment option to continue.
- UI element:
- Result: The "Payment Method" radio button field on your checkout form will now be mandatory. If a user tries to submit the form without selecting a payment method, they will see the message "Please select a payment option to continue."
Example 2: Make an "Opt-in to Newsletter" field optional.
- Inputs:
- UI element:
Opt-in to Newsletter(a radio button field on your registration form) - Required:
False - Required message: (Leave blank)
- UI element:
- Result: The "Opt-in to Newsletter" radio button field on your registration form will be optional. Users can submit the form whether they select an option or not, and no required message will appear.
Example 3: Make a "Shipping Preference" field mandatory using the default message.
- Inputs:
- UI element:
Shipping Preference(a radio button field on your order form) - Required:
True - Required message: (Leave blank)
- UI element:
- Result: The "Shipping Preference" radio button field on your order form will become mandatory. If a user tries to submit the form without making a selection, they will see the platform's default "This field is required" message.