- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 11:44 PM
Hi,
I have 2 radio buttons on my ui page with options yes/no.
I want to make this mandatory and allow only one value to be selected at time.
Currently, both options are getting selected.
My code :
<label>select your option </label><br/>
<input type="radio" name="yes" id="yes" value="Yes">Yes</input><br/>
<input type="radio" name="no" id="no" value="No">No</input><br/>
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2022 12:05 AM
for mandatory add required="true" to one of the tag
<label>select your option </label><br/>
<input type="radio" name="my_button" id="yes" value="Yes" required="true">Yes</input><br/>
<input type="radio" name="my_button" id="no" value="No">No</input><br/>
OR
try this
<label>select your option </label><br/>
<input type="radio" name="my_button" id="yes" value="Yes" required>Yes</input><br/>
<input type="radio" name="my_button" id="no" value="No">No</input><br/>
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 11:49 PM
Have only one radio button. If selected YES otherwise consider it as NO. Change the label from Select your option to a question whether to select Yes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 11:51 PM
PLease try this
<label>select your option </label><br/>
<input type="radio" name="yes_no" id="yes" value="Yes">Yes</input><br/>
<input type="radio" name="yes_no" id="no" value="No">No</input><br/>
Please Mark this as correct if its helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 11:59 PM
how can i make this mandatory ? becasue these two are two different radio buttons. At the time of my submit i have to check either one of them is checked as true .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2022 12:44 AM
you just need to add required=true