cancel
Showing results for 
Search instead for 
Did you mean: 
Nintex Newbie

Remove check from Yes checkbox when No checkbox is checked

Jump to solution

I have 2 checkboxes on my form. Yes and No. When Yes is checked, a panel is opened. I have a rule to close the panel when No is checked but the Yes box remains checked. How can I remove the check from the Yes box?

 

Yuri

Labels: (1)
0 Kudos
Reply
6 Replies
Highlighted
Nintex Employee
Nintex Employee

Re: Remove check from Yes checkbox when No checkbox is checked

Jump to solution

Hi Yuri.  Are you using the New Responsive Designer, Responsive Designer, or Classic Designer?

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Remove check from Yes checkbox when No checkbox is checked

Jump to solution
Classic Designer
0 Kudos
Reply
Highlighted
Nintex Employee
Nintex Employee

Re: Remove check from Yes checkbox when No checkbox is checked

Jump to solution

You'll have to use JavaScript in a Classic form to accomplish this.  Try adding the code below to the Custom JavaScript section in Form Settings.  Then go to the Control Settings for both Yes/No controls, change the "Store Client ID in JavaScript variable" setting in Advanced to Yes, and add yescheckbox or nocheckbox (respectively) in the "Client ID JavaScript variable name" in each control.  This should uncheck the Yes checkbox if the No checkbox is selected.  You can keep the hide rule on the No checkbox.

 

NWF$(document).ready(function () { 
var checkedno= NWF$("#" + nocheckbox); 
checkedno.change(function(){ 
NWF$('#'+yescheckbox).prop('checked', false) 
}); 
});

NWF$(document).ready(function () { 
var checkedyes= NWF$("#" + yescheckbox); 
checkedyes.change(function(){ 
NWF$('#'+nocheckbox).prop('checked', false) 
}); 
});

 

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Remove check from Yes checkbox when No checkbox is checked

Jump to solution

This solution works great. However, I have a new problem.

When I click the Yes button, the panel opens and when I click No, the panel closes. Perfect

But when I click the Yes button again, the panel does not open. I need it to open because I know some user is going to click the wrong box.

0 Kudos
Reply
Highlighted
Nintex Employee
Nintex Employee

Re: Remove check from Yes checkbox when No checkbox is checked

Jump to solution

I checked my solution on Chrome and Edge, and it's working as expected.  If I click on the Yes checkbox, then the panel displays.  When I click on the No checkbox, the panel hides and the Yes checkbox is unchecked.  Then I check the Yes checkbox again and the panel displays and the No checkbox is unchecked.

 

Some things to check.  Make sure the Yes checkbox is named yescheckbox in the "Client ID JavaScript variable name" setting under Advanced and the No checkbox is named nocheckbox in the "Client ID JavaScript variable name" setting under Advanced.  I also have the form rule on associated to the panel control.  Also make sure the full JavaScript is in the Custom JavaScript section of Form Settings.

 

YesNo_JavaScript1.png

 

YesNo_JavaScript2.png

 

YesNo_JavaScript_Rule.png

View solution in original post

Reply
Highlighted
Nintex Newbie

Re: Remove check from Yes checkbox when No checkbox is checked

Jump to solution
bamaeric,

It works perfectly. Thanks for all your help.
0 Kudos
Reply