Hide Submit Button Unless all Radio Options are “Yes”
Please note that this is now available as a plugin for easier installation. While you can use this document as a reference, the recommended method to add…
- Not yet re-checked
- Classic builder
Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.
Since submit button display rules do not currently have the functionality to hide the submit button, this solution will allow you to hide the submit button from view on the page unless all options of yes are selected.
Step 1
Add the class of "radio" to each radio field in your form.
Step 2
In the options tab of your form add the class "radio-hide" to the submit button CSS class.
Step 3
Hover over the info icon of your form component to get the component ID.
Step 4
Add the following code to the JavaScript tab of your page.
var check = function(vals, numVals) {
var x, status = 0;
for (x of vals) {
if (x.value == "Yes") {
status++;
}
}
if (status != numVals) {
$(".radio-hide").hide();
} else {
$(".radio-hide").show();
}
};
TB.render('component_3', function(data) {
var options = $(".radio .tb-radio"),
numOptions = $(".radio").length;
check($(".radio .selected input"), numOptions);
options.click(function() {
if ($("input", this)[0].value == "Yes") {
$(this).addClass("selected");
} else {
$(this.previousElementSibling).removeClass("selected");
}
Original Community Post:
Was this page helpful?
Something wrong or missing on this page? Tell us.