You are viewing limited content. For full access, please sign in.

Question

Question

FORMS- Hide/Show the Approve or Reject button based on selection of a Radio Button

asked on May 9, 2016

Hi,

For Forms, I found sample code on another post to hide/show the submit & reject buttons based on the selection of a drop down field.  Does anyone have code that would do the same thing based on a radio button?

 

Thank you in advance,

Terri

0 0

Answer

SELECTED ANSWER
replied on May 9, 2016 Show version history

Hello Terri,

 

I was able to control the Approve and Reject buttons using the code below:

$(document).ready(function () {
  $("#q1").on("change", function() {
    if($('#Field1-0').is(':checked')) {
  	$(".action-btn.Reject").hide();
        $(".action-btn.Approve").show();
  	}
   	 if($('#Field1-1').is(':checked')) {
    	$(".action-btn.Approve").hide();
       	$(".action-btn.Reject").show();
   	 }
	});
});

Where q1 is the id of the radio button field. Field1-0 and Field1-1 are the ids of the radio button selections and can be found by right clicking the radio button and selecting inspect element, which will bring up a window showing the ids as shown below:

Hope this helps!

2 0
replied on May 9, 2016

This code is based off of having only 2 radio buttons that select which button is shown and which button is hidden.

0 0
replied on May 9, 2016

Thank you- This works perfectly

0 0
replied on June 10, 2019 Show version history

I've applied this to a checkbox variable and it works properly when you check/uncheck the box.  However it doesn't automatically execute when the page first loads.  I would like the Approve button hidden when the page first loads as the variable is always unchecked, but currently both buttons are showing.  Any suggestions?

0 0
replied on August 3, 2020

Thank You Winston for the answer and to Terri for asking the original question!

It worked for my Approve / Deny radio buttons.

Christine

0 0

Replies

replied on June 17, 2019

Can this be adapted to a upload field? I renamed the actions buttons to "objection" and "no objection" I will like to have the "No Objection" button appear when they have uploaded an specific document. Is this possible?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.