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
TLFTLF 

How do you get a " character to appear in a sectionHeader title or subtitle?

Ok, I feel kind of dumb asking this, but I'm trying to get double quote characters to appear in either the title or subtitle attributes of an <apex:sectionHeader>. I tried using &quot;, but that gets converted into "&#34;" in the rendered page. I also tried using the " character directly, but the Visualforce compile gets confused by the nested quotes in the title or subtitle attribute. Am I missing something obvious?

Best Answer chosen by Admin (Salesforce Developers) 
tukmoltukmol

i haven't found a way either to do it direcly within the apex tag

 

if acceptable, you can use a pair of left and right double quotes (“ ”)

 

but if you extremely need " you can create a String property in your controller that solely returns this character, i.e.

 

    public String strQuote {
get {return '"';}
}

 

then you can refer to it in you apex tag like this:

<apex:pageBlockSection columns="1" title="{! strQuote}Section Title{! strQuote}" >

 

you can also do it via javascript &colon;D

All Answers

TLFTLF

I just built my title string containing " in the controller and rendered it that way. Seems like there ought to be a pure Visualforce way of doing this though.

tukmoltukmol

i haven't found a way either to do it direcly within the apex tag

 

if acceptable, you can use a pair of left and right double quotes (“ ”)

 

but if you extremely need " you can create a String property in your controller that solely returns this character, i.e.

 

    public String strQuote {
get {return '"';}
}

 

then you can refer to it in you apex tag like this:

<apex:pageBlockSection columns="1" title="{! strQuote}Section Title{! strQuote}" >

 

you can also do it via javascript &colon;D

This was selected as the best answer
TLFTLF

I like your suggestion of having a controller variable that just returns the " character and concatenating that into the rendered title or subtitle. More flexible than my approach where I just built the whole string controller side.