function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Venkat NithinVenkat Nithin 

Hide Private Checkbox on Notes & Attachments Section

 

Hi, 
I wanted to get rid of Private Check box on the notes & attachments section, As this list is not customizable i know that it can be hidden on the UI using javascript by entering the DOM of the page.
For this I created a home page component - html area - narrow left and added the following js code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>  
<script type="text/javascript">
<script type="text/javascript">
function hidePrvChkbx() {
    if(document.getElementById('IsPrivate')!=null) {
       document.getElementById('IsPrivate').diabled='true';
    }
}
window.onload = function() {
    window.setTimeout(hidePrvChkbx,0);
}
</script>
 


And added this to the home page layout, And that is working fine.
 
The problem is, We have another JavaScript component called - PostcodeAnywhere which helps in finding the postcode. This is getting affected by the above code.
Out of my research I noticed that, Even Postcode JS is using Window.Onload function to transeverse through the DOM. And I have another onload() function in my code. Which to my knowledge seems to be they both are conflicting.
 
Is there any other Event Objcet that I can make use of to execute my piece of code in JavaScript without affecting the Postcode finder??
Postcode anywhere is a Managed pakcage.. FYI..!!
 
Would really be a great help if this could be solved.
Thanks in advance


Ven
sfdcfoxsfdcfox

Use jQuery's $.load( <event handler> ) function, like this:

 

<script type="text/javascript">
$.load( hidePrvChkbx );
// your functions here
</script>

This method uses addEventHandler/attachEvent methods to correctly fire off the code.

Venkat NithinVenkat Nithin

Hi

 

It doesnt seem to be firing..

Its not  affecting postcode anywhere though, but I am able to see the checkbox..

 

The code is as follows:

<script type="text/javascript">$.load( hidePrvChkbx );

function hidePrvChkbx()

{    if(document.getElementById('IsPrivate')!=null)

 {       document.getElementById('IsPrivate').diabled='true';   

  }

}

window.onload = function() {   

window.setTimeout(hidePrvChkbx,0);

 }

</script>

 

 

 

Sekhar Babu K 6Sekhar Babu K 6
Hi,

I am facing same issue, I need to disabled the private checkbox in the Attachment standard page layout. I created the Home page component and it is not working for me. Please can you provide steps for this.