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
ShawnFShawnF 

standardStylesheets="false" makes apex:outputfield render twice

I'm writing a visualforce page that has a lot of custom styles.

 

I added the standardStylesheets="false" attribute to my apex:page so as not to interfere with my custom styles.

 

When I did so, all of my apex:outputfields began rendering twice on the page.

 

Here is a screenshot.

 

Two questions:

  1. Does anyone know WHY this is happening?
  2. If so, do you have a solution to keep the "Text Area (Rich) " apex:outputfields from rendering twice?

NOTE: All outputfields I'm referencing in the screenshot above are the new "Text Area (Rich) " fields (which are listed as beta) on a custom object I've named "Spec Sheets".

Best Answer chosen by Admin (Salesforce Developers) 
ShawnFShawnF

*Potential Solution*

 

The user above is correct to point out that the second time the field is rendered, it is rendered in an iframe.

 

After a view source, you can identify that each iframe has a CSS class of class="htmlDetailElementIframe"

 

In your custom CSS, just use the below style and the second field will go away:

 

.htmlDetailElementIframe{
display: none;
}

All Answers

imuinoimuino

It happens to me, check on the code after the page is rendered you'll see that in the outputextField apex put an iFrame, i dont know why, the only way i found to keep it out its by hidding it with JavaScript so then you'll se it only once

imuinoimuino

It happens to me, check on the code after the page is rendered you'll see that in the outputextField apex put an iFrame, i dont know why, the only way i found to keep it out its by hidding it with JavaScript so then you'll se it only once

ShawnFShawnF

Thanks. What javascript did you use to hide the iframe? Can you provide source code?

sforce2009sforce2009

Guys, its strange. its not happening to me.

ShawnFShawnF

I just tried again and am still getting the same problem.

 

One other question that came to mind was: "What is SFDC doing in the standardStylesheet that keeps the fields from being rendered twice?"

 

Meaning:

 

  1. if standardStylesheet = false, then the fields do render twice
  2. if standardStylesheet = true, then the fields do not render twice

So SFDC must be using a technique in the standardStylesheet that keeps them from being rendered twice. If I can identify that technique used in the standardStylesheet, then I can use that same technique in my custom style sheet.

 

I just don't know what that is yet.

ShawnFShawnF

*Potential Solution*

 

The user above is correct to point out that the second time the field is rendered, it is rendered in an iframe.

 

After a view source, you can identify that each iframe has a CSS class of class="htmlDetailElementIframe"

 

In your custom CSS, just use the below style and the second field will go away:

 

.htmlDetailElementIframe{
display: none;
}

This was selected as the best answer