Skip to main content
Nintex Community Menu Bar
Solved

Remove check from Yes checkbox when No checkbox is checked

  • January 15, 2020
  • 8 replies
  • 607 views

yuri

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

Best answer by bamaeric

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.


 



 



 


View original
Translate
Did this topic help you find an answer to your question?

bamaeric
Forum|alt.badge.img+13
  • Apprentice
  • January 15, 2020

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

Translate

yuri
  • January 15, 2020
Classic Designer
Translate

bamaeric
Forum|alt.badge.img+13
  • Apprentice
  • January 15, 2020

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)
});
});

 

Translate

yuri
  • January 17, 2020

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.

Translate

bamaeric
Forum|alt.badge.img+13
  • Apprentice
  • January 17, 2020

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.


 



 



 


Translate

yuri
  • January 17, 2020
bamaeric,

It works perfectly. Thanks for all your help.
Translate

I'm using this exact solution but it only works on IE 11, the check box doesn't do anything on Edge or Chrome. Any ideas why it would happen like this?

Translate

Forum|alt.badge.img+1
  • Rookie
  • September 30, 2022
Hi, I found an issue for my part ! How can I uncheck several checkboxes with only one checkbox on true ?
Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings