JanineB Posted March 2, 2022 Report Share Posted March 2, 2022 Hi! Is there a way for me to auto-select all options in the Listbox when a certain value of the radio button is selected? Thanks! Quote Link to comment Share on other sites More sharing options...
Kurumi Posted March 2, 2022 Report Share Posted March 2, 2022 Hi @JanineB - you may try this code: <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { var radios = document.getElementsByName("EditRecordFIELDNAME_RADIOBUTTON"); for(i = 0; i < radios.length; i++) { if(radios[i].addEventListener('change', function() { if (this.value == 5) { var box = document.querySelectorAll("input[id*='EditRecordFIELDNAME_LISTBOX']"); for (var i=0; i < box.length ;i++){ box[i].checked=true; document.querySelector("input[id*='selectAllCbx_FIELDNAME']").click(); } } else { var box= document.querySelectorAll("input[id*='EditRecordFIELDNAME_LISTBOX']"); for (var i=0; i < box.length ;i++){ box[i].checked=false; document.querySelector("input[id*='selectAllCbx_FIELDNAME']").click(); } } })); } }); </script> This is for Details Page or Update Form. If you are planning to use it in the Submission Form, it will be InsertRecordFIELDNAME. Kindly change the FIELDNAME as well to the correct name of your field. This code means that it will first get all values from the radio button and when it is changed, it will check if the value is equal to 5. If the radio = 5 THEN select the Listbox AND check all options. If the radio is not equal to 5 THEN it will uncheck all options. Hope it helps! JanineB 1 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.