The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Trouble making a radio button or drop down required.
I need to have some kind of a select just one form field, and it needs to be required. I'm not seeing how to make that happen. Radio buttons would work best for user experience, but radio buttons don't have any "option not selected". Even a drop down doesn't seem to work? I thought I could use a "please select" as the first option with no value but that doesn't trigger the required warning either.
Any suggestions? Thanks!
January 1, 2019 at 12:39 pm
Maybe I'm not understanding what you are trying to do. Both radio buttons and drop downs have a checkbox to make them required. Isn't that enough? If not, please explain what you're trying to do with more detail.
January 1, 2019 at 3:47 pm
Hey vfontjr,
Clicking on the checkbox to make them required does not seem to do anything at all. In the case of the radio buttons, there's always a button selected by default so in effect the field passes the required without doing anything. Drop down acts the same way as far as I can tell.
Am I missing something? It is possible to use either the radio buttons or drop down and have nothing selected when the form loads?
January 2, 2019 at 6:30 am
When you add a radio button group to a form, nothing is selected as a default. You only get a default selection when you click on one of the radio buttons. If you don't click on anything, nothing will be selected.
As for drop downs, I usually keep a blank entry at the top of every drop down list.
I also use this small snippet of code to clear all radio buttons and checkboxes:
/* checkboxes and radio buttons */
$("input[type=checkbox], input[type=radio]").each( function() {
var elem_name = $(this).attr('name');
$("input[name='" + elem_name + "']").prop("checked", false);
});
Discussion closed.