PotatoMato Posted October 22, 2021 Report Share Posted October 22, 2021 Hi everyone. If you want to add a 'Select All' to check all the checkboxes. You may try the code below on your DataPage: HTML Block: Select All<input onclick="toggle(this);" type="checkbox" /> Footer: <script language="JavaScript"> function toggle(source) { var checkboxes = document.querySelectorAll('input[type="checkbox"]'); for (var i = 0; i < checkboxes.length; i++) { if (checkboxes[i] != source) checkboxes[i].checked = source.checked; } } </script> Output: -Potato Meekeee 1 Quote Link to comment Share on other sites More sharing options...
Kronos Posted January 17 Report Share Posted January 17 Thank you, this was really helpful to my workflow but I added some changes since I want to have two select all option on my form. It seems that the numbering will continue even on the second checkboxes on the for loop in the code. I'll share it here just in case someone will have a similar workflow. Here is the code I used: <script language="JavaScript"> function toggle(source) { var checkboxes = document.querySelectorAll('input[type="checkbox"]'); for (var i = 0; i < 4; i++) { if (checkboxes[i] != source) checkboxes[i].checked = source.checked; } } function toggle2(source) { var checkboxes = document.querySelectorAll('input[type="checkbox"]'); for (var i = 4; i < 8; i++) { if (checkboxes[i] != source) checkboxes[i].checked = source.checked; } } </script> Also I added a new HTML block for the second select all checkbox: Select All<input onclick="toggle2(this);" type="checkbox" /> This is the Output: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.