Vitalikssssss Posted June 19, 2020 Report Share Posted June 19, 2020 Hi there, I have some check boxes, for example 5 and I want the form to not being submitted if at least one of them is checked. How can I do that? Thank you for looking into my question. Quote Link to comment Share on other sites More sharing options...
0 Alison Posted June 19, 2020 Report Share Posted June 19, 2020 Hi @Vitalikssssss, You may use the following code to prevent submittion if non of the checkboxes were not checked: <script> document.addEventListener("BeforeFormSubmit", myFunction); function myFunction() { let FirstField = document.getElementById("InsertRecordnnn").checked; let SecondField = document.getElementById("InsertRecordname").checked; let ThirdField = document.getElementById("InsertRecordTF").checked; let FourthField = document.getElementById("InsertRecordnumber").checked; if (!FirstField && !SecondField && !ThirdField && !FourthField) { event.preventDefault(); //for hiding the button container: //document.getElementsByClassName("cbSubmitButtonContainer")[0].style.display="none"; } }; </script> The code should be added into the datapages' footer. Also you should rename the fields in the code to the ones you have on your form. Please see the screenshot for better understanding: Quote Link to comment Share on other sites More sharing options...
Question
Vitalikssssss
I have some check boxes, for example 5 and I want the form to not being submitted if at least one of them is checked.
Link to comment
Share on other sites
1 answer to this question
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.