Skip to main content

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('inputivalue='Laptop']').attr('checked', 'checked');

NWF$('#'+varLTCase).find('inputivalue='Case']').attr('checked', 'checked');

NWF$('#'+varCableLock).find('inputivalue='Cable Lock']').attr('checked', 'checked');

};

 

function populateExecutiveBundle(){

NWF$('#'+varDesktop).find('inputfvalue='Desktop']').attr('checked', 'checked');

NWF$('#'+varLaptop).find('inputfvalue='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=====

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

use prop() everywhere.


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


laugh.png


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


Reply