Jump to content

Make fields display only on report data page after checkbox is check (using java/NO RULES)


Recommended Posts

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>

 

Link to comment
Share on other sites

 

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

Link to comment
Share on other sites

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>

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...