Solved

Check All Check Boxes

  • 27 July 2022
  • 4 replies
  • 118 views

Userlevel 1
Badge +4

I have a Classic 2013 form with a cascading checkbox. 

I need to be able to Select All check box results. 

I've asked this question before but have yet to find an answer. Please help!
 

Describer:
1. Select Specialty. This control is a Choice Field with drop down selected. Java name "Specialty"

24748iB4628FA4A3B527CB.png

2. A list of emails pops up. This control is a SharePoint List Lookup with check box (Multiple-Selection) selected. Java name "emailID"

24749iE3FADD3A7BC33230.png

3. I have a checkbox on my form. Java name "SelectAll"

4. I would like to be able to check "SelectAll" and have all the email check boxes (emailID) checked. 

 

Please and thank you

icon

Best answer by MegaJerk 28 July 2022, 15:24

View original

4 replies

Userlevel 5
Badge +14

This is pretty simple but includes some custom code so I will try to make it as simple as I can. 


 


I didn't want to try to recreate your lists for lookup exactly, and already had a list I use for dummy lookups called Fruits List, so I have created another list of Fruit Experts who all have some amount of Fruits associated to them via a Lookup:



 



 


The Fruit Experts List Titles will stand in for the "EmailID" emails on your form


 


Speaking of forms, I have made a dummy form close to what I've seen of yours:



 


I've also configured the Controls to have the same JavaScript ID names as what you've given to your controls:



 


Email IDs



 


Select All checkbox



 


The rest is pretty straight forward. Open up the Settings of your form using the Settings button in the Ribbon:



 


Then expand the "Custom JavaScript" section, paste in the following code, and save:


 


NWF.FormFiller.Events.RegisterAfterReady(function () {
NWF$("#" + Specialty).on("change", function(event){
NWF$("#" + SelectAll).prop("checked", false);
});

NWF$("#" + SelectAll).on("change", function(event){
var isChecked = NWF$(event.target).prop("checked");
if (isChecked) {
NWF$("#" + emailID).siblings("table").find("input:checkbox").each(function(index, checkbox){
NWF$(checkbox).prop("checked", true);
});
}
});
});

 


 


As Shown:



 


The Results will be that now when your form is loaded, the Select All button should check all of the checkboxes in the emailID Control, and if you make a change to the Specialty (or in my case, fruit), it will uncheck the "Select All" checkbox:



 



 



 


Let me know if you need further assistance. 


 


 


 


 

Userlevel 1
Badge +4

That worked perfect! Thank you so much! I'm having one more tiny issue...


I have a Calculated Value Field, Java Name "EmalCalc" . 


It used to pull in the values when the check boxes were checked.  
Now that the Select All feature has been added, this isn't happening. I can still get it to work if I manually click on the check boxes. 
Here is the formula I am using. I need this to populate with all the emails when Select All is clicked. 



Please and thank you! 


 


 

Userlevel 5
Badge +14

No need to do anything to that control, I just modified the code I gave you above to the following:


NWF.FormFiller.Events.RegisterAfterReady(function () {
NWF$("#" + Specialty).on("change", function(event){
NWF$("#" + SelectAll).prop("checked", false);
});

NWF$("#" + SelectAll).on("change", function(event){
var isChecked = NWF$(event.target).prop("checked");
if (isChecked) {
NWF$("#" + emailID).siblings("table").find("input:checkbox").each(function(index, checkbox){
NWF$(checkbox).prop("checked", true).trigger("change");
});
}
});
});

 


It now has a trigger which indicates to the form that the control should update any dependencies, and should make your Calculated Control update correctly. 


 


Please mark this thread as solved if this concludes the answers to this problem.  

Userlevel 1
Badge +4

Woooohooo! That did it! Thank you so much!

Reply