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
srinivasusrinivasu 

how to render a VF page without Custom Link section using <apex:detail> tag?

Hi,

 

Is it possible to render a VF page without a particular section for eg: Custom Links,System Information. I have to use <apex:detail> tag because of some restrictions. I have tried using javascript and was able to remove buttons and links (like Owner,View Hierarchy).

 

Is it possible to read the html id or name for Custom link section using document.getElementbyID and make it as display:none or something.

 

Kindly suggest..

Sanchivan SivadasanSanchivan Sivadasan

If I understand you correctly, you will hide some information that shows up when you use the <apex:detail> tag. You can archieve this easily by modifying the page layout for the user. 

 

Did this answer your question, If yes please mark it as the solution. Thanks.

srinivasusrinivasu

Hi,

 

I have to handle it in visualforce page. I cannot change the page-layout.

 

Kindly suggest if i can read the id or name of Custom Link section using javascript and disbale it.

 

 

Regards

Srinivasu

 

Andy BoettcherAndy Boettcher

If you throw this in a <script> block right after your <apex:page>, it should do it.

 

** I tested this as a Custom Button on a Standard Account Layout for the Cases Related List. - it worked there.  You will have to find your own Related List class name.

 

<script>
    
    var previousOnload = window.onload;        
    window.onload = function() { 
        if (previousOnload) { 
            previousOnload();
        }

	var elements= getElementsByClassName('listRelatedObject caseBlock');
	var n = elements.length;

	for (var i = 0; i < n; i++) {
    	var e = elements[i];
		e.style.display = 'none';
	}

    }
</script>

 

srinivasusrinivasu

Hi,

 

Thank you for the response..

But i have to remove Custom Links section which is not a related list. If we use <apex:detail> tag it comes automatically, but we have to remove it but we do not have any control over it...Is it possible.

 

 

Thanks and regards

Srinivasu

Andy BoettcherAndy Boettcher

The premise should be the same - check out the HTML source behind the scenes and there should be a DIV or SPAN that holds that information.

srinivasusrinivasu

Hi,

 

Thank u for the information...

I tried using your code and was able to remove the links part for which the class name i found from the

 html source to be "customLinks".  But i have to remove the entire Custom Link section which is under the div class <div class="pbSubheader tertiaryPalette".

As there are many such classes i cannot  remove it directly.

 

HTML source for that part:

<div class="pbSubheader tertiaryPalette" id="head_1_ep_page_detail"><h3>Custom Links<span  class="titleSeparatingColon">:</span></h3></div><div class="pbSubsection"><table  class="detailList" border="0" cellpadding="0" cellspacing="0"><tr><td class="labelCol empty last">&nbsp;</td><td class="data2Col last" colspan="3"><table  class="customLinks" border="0" cellpadding="0" cellspacing="0"><tr class="first"><td><script  type="text/javascript">__sfdcSessionId = '</script>

 

 

Code using:(but not able to remove entire Custom Link section)

 

<apex:page standardController="Account" standardStylesheets="true" sidebar="false" showHeader="false" >

<style>

.btn{display:none};
.customLinks{display:none};

</style>

<script>
   
    var previousOnload = window.onload;       
    window.onload = function() {
        if (previousOnload) {
            previousOnload();
            alert('inside');
        }

   j=0;
  //  var b = getElementsByClassName("pbSubheader tertiaryPalette");
   // var b = getElementsByTitle("Hide Section - System Information");
    var b = getElementsByTagName("DIV");
    alert('inside div1');
                while (element = b[j++]){
                alert('inside div2');
                  if(element.innerHTML=="Custom Links"){
                  alert('inside div3');
                      element.innerHTML="";
                  }

    }

    }
</script>

<style>
pre
{
white-space: -moz-pre-wrap; /* Mozilla, supported since 1999 */
white-space: -pre-wrap; /* Opera 4 - 6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* CSS3 - Text module (Candidate Recommendation) http://www.w3.org/TR/css3-text/#white-space */
word-wrap: break-word; /* IE 5.5+ */
}

 

 

@page :first
{

margin-top:0%;
@top-center
{
content: element(header2);
}
}

@page
{
margin-top: 15%;
@top-center
{
content: element(header1);
}

@bottom-right
{
content: "Page: " counter(page) " / " counter(pages);font-size: 80%;
}
}

div.header1
{
position: running(header1);
width:703px;
padding-left:9px;
}
div.header2
{
width:700px;
padding-bottom:0px;
padding-left:2px;

}

.table1Value{color: #333333; font-size: 70%;text-align: center;border-bottom:0px double #605E5E;}
</style>
<apex:detail relatedList="false" />

</apex:page>

 

 

 

 

 

 

Please suggest....