cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Checkboxes can no loger be checked/selected programmatically after clearing them

Jump to solution

Hello!

 

I am creating an order form and have custom JavaScript functions that check checkboxes based on the bundle selected.

Checking those boxes work without problems.

When the bundle is changed, I want to clear all boxes first, then check the appropriate boxes for the new bundle selected.

 

My problem: When the checkboxes are cleared, either by the “clearAllCheckboxes()” function or manually, the checkboxes can no longer be checked programmatically. What am I missing?

 

Here is my code:

//COMPUTER BUNDLE =====

 

function populateSalesBundle(){

NWF$('#'+varLaptop).find('input[value=\'Laptop\']').attr('checked', 'checked');

NWF$('#'+varLTCase).find('input[value=\'Case\']').attr('checked', 'checked');

NWF$('#'+varCableLock).find('input[value=\'Cable Lock\']').attr('checked', 'checked');

};

 

function populateExecutiveBundle(){

NWF$('#'+varDesktop).find('input[value=\'Desktop\']').attr('checked', 'checked');

NWF$('#'+varLaptop).find('input[value=\'Laptop\']').attr('checked', 'checked');

};

 

function populateWorkFromHomeBundle(){

NWF$('#'+varLaptop).find('input[value=\'Laptop\']').attr('checked', 'checked');

NWF$('#'+varKeyboard).find('input[value=\'Keyboard\']').attr('checked', 'checked');

NWF$('#'+varDockingStation).find('input[value=\'Docking Station\']').attr('checked', 'checked');

NWF$('#'+varLTCase).find('input[value=\'Case\']').attr('checked', 'checked');

NWF$('#'+varCableLock).find('input[value=\'Cable Lock\']').attr('checked', 'checked');

NWF$('#'+varDTMonitor).find('input[value=\'Monitor\']').attr('checked', 'checked');

NWF$('#' + varDTMonitorQty).val(2);

};

 

function clearAllCheckboxes(){

NWF$('input[type=checkbox]').prop('checked', false);

};

 

//END COMPUTER BUNDLE SECTION=====

0 Kudos
Reply
5 Replies
Workflow Hero

Re: Checkboxes can no loger be checked/selected programmatically after clearing them

Jump to solution

I would say the problem is you mix prop() and attr().

use prop() everywhere.

Reply
Workflow Hero

Re: Checkboxes can no loger be checked/selected programmatically after clearing them

Jump to solution

Thank you so much for your quick reply. I will try that.

I am very new to Nintex and I just copy codes that I find online

Reply
Not applicable

Re: Checkboxes can no loger be checked/selected programmatically after clearing them

Jump to solution

Welcome, ‌!

You're in excellent hands with ‌. Let us know how things are going as you make those suggested changes.

Good luck!

Reply
Workflow Hero

Re: Checkboxes can no loger be checked/selected programmatically after clearing them

Jump to solution

0 Kudos
Reply
Workflow Hero

Re: Checkboxes can no loger be checked/selected programmatically after clearing them

Jump to solution

Much thanks, Marian! That change from "attr" to "prop" made the script work.

Reply