aquintanilla Posted August 26, 2021 Report Share Posted August 26, 2021 Hi! Is there a way to configure the data page in a report data page, that when the checkbox at the end is checked, then all the fields become no editable? I already tried with rules but its not working as I expected. Quote Link to comment Share on other sites More sharing options...
telly Posted August 26, 2021 Report Share Posted August 26, 2021 Hi @aquintanilla, Have you tried separating the checkbox (Yes/No) into section then create a rule where if the field is equal to yes then disable the section 2: Here an example: Quote Link to comment Share on other sites More sharing options...
TellMeWhy Posted August 26, 2021 Report Share Posted August 26, 2021 1 hour ago, aquintanilla said: Hi! Is there a way to configure the data page in a report data page, that when the checkbox at the end is checked, then all the fields become no editable? I already tried with rules but its not working as I expected. Where in the DataPage? Search Form or Details Page? Is the checkbox an actual field or can it be a Virtual Field? Is the checkbox ALWAYS unchecked first, with the fields editable, and once checked, all fields will be uneditable? Is the checkbox included in the uneditable fields? This is possible, tho, we need to answer those questions first. I tried this on a Search Form, Virtual Field 1 > Set as Checkbox with the following script If checked, all fields are uneditable, if not, editable <script> document.getElementById("cbParamVirtual1").addEventListener("change", function f1(){ var myForm = document.getElementById('caspioform').querySelectorAll('input:not([type=submit]):not([type=hidden]):not([id=cbParamVirtual1]), textarea, select'); //get all fields EXCEPT with type submit, hidden, and id cbParamVirtual1, so I can still uncheck it if(document.getElementById("cbParamVirtual1").checked){ myForm.forEach(function elements1(elem) { elem.style.pointerEvents="none"; }); }//end of if else{ myForm.forEach(function elements2(elem) { elem.style.pointerEvents="auto"; }); }//end of else });//end of event listener </script> Quote Link to comment Share on other sites More sharing options...
aquintanilla Posted August 27, 2021 Author Report Share Posted August 27, 2021 18 hours ago, TellMeWhy said: Where in the DataPage? Search Form or Details Page? Is the checkbox an actual field or can it be a Virtual Field? Is the checkbox ALWAYS unchecked first, with the fields editable, and once checked, all fields will be uneditable? Is the checkbox included in the uneditable fields? This is possible, tho, we need to answer those questions first. I tried this on a Search Form, Virtual Field 1 > Set as Checkbox with the following script If checked, all fields are uneditable, if not, editable <script> document.getElementById("cbParamVirtual1").addEventListener("change", function f1(){ var myForm = document.getElementById('caspioform').querySelectorAll('input:not([type=submit]):not([type=hidden]):not([id=cbParamVirtual1]), textarea, select'); //get all fields EXCEPT with type submit, hidden, and id cbParamVirtual1, so I can still uncheck it if(document.getElementById("cbParamVirtual1").checked){ myForm.forEach(function elements1(elem) { elem.style.pointerEvents="none"; }); }//end of if else{ myForm.forEach(function elements2(elem) { elem.style.pointerEvents="auto"; }); }//end of else });//end of event listener </script> Hi! Answering your questions: Where in the DataPage? Search Form or Details Page? - on the Details Page Is the checkbox an actual field or can it be a Virtual Field? - It is an actual field Is the checkbox ALWAYS unchecked first, with the fields editable, and once checked, all fields will be uneditable? - Yes, it is unchecked at first always with the fields editable and once checked all the fields must be undeditable Is the checkbox included in the uneditable fields? - Yes Quote Link to comment Share on other sites More sharing options...
TellMeWhy Posted August 27, 2021 Report Share Posted August 27, 2021 54 minutes ago, aquintanilla said: Hi! Answering your questions: Where in the DataPage? Search Form or Details Page? - on the Details Page Is the checkbox an actual field or can it be a Virtual Field? - It is an actual field Is the checkbox ALWAYS unchecked first, with the fields editable, and once checked, all fields will be uneditable? - Yes, it is unchecked at first always with the fields editable and once checked all the fields must be undeditable Is the checkbox included in the uneditable fields? - Yes Okay, that makes it simpler then. Try this <script> document.getElementById("EditRecordFIELDNAME").addEventListener("change", function f1(){ var myForm = document.getElementById('caspioform').querySelectorAll('input:not([type=submit]):not([type=hidden]), textarea, select'); //get all fields EXCEPT with type submit, hidden, and id cbParamVirtual1, so I can still uncheck it if(document.getElementById("EditRecordFIELDNAME").checked){ myForm.forEach(function elements1(elem) { elem.style.pointerEvents="none"; }); }//end of if });//end of event listener </script> 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.