+ Start a Discussion
Mitesh SuraMitesh Sura 

Found a bug in apex dynamic component

Looks like a bug to me unless someone tells me I am doing something wrong.

 

Cannot add straight HTML to outputText if the value is dynamic. On other hand if it same value, but provided as static value it works fine. Please see below:

 

Component.Apex.outputText txt = new Component.Apex.outputText(value=dynamicValue, escape=false); // DOES NOT WORK
			
Component.Apex.OutputText txt = new Component.Apex.OutputText(value='<b>A Heading</b>', escape=false); //WORKS FINE

//dynamicValue is same as "<b>A Heading</b>", but it won't work. 

 

 

Vinita_SFDCVinita_SFDC

Hello,

Try refering the dynamic value like this

 
     Component.Apex.OutputText htmlTxt = new Component.Apex.OutputText();
     htmlTxt.value =dynamicValue;
     htmlTxt.escape = false;

Mitesh SuraMitesh Sura
Vinita,

I wish that worked. I had tried that as well.
Vinita_SFDCVinita_SFDC

Hello,

 

Can you please share the code, how are you getting the dynamicvalue?

Mitesh SuraMitesh Sura

Please see below, the code is part of method that is called form VF page. 

 

template.T_C__c is a rich text field. 

 

public Component.Apex.OutputPanel getTandC(){
        
  Component.Apex.OutputPanel pnlParent = new Component.Apex.OutputPanel();
for(string block : template.T_C__c.split('-PageBreak-')) {
Component.Apex.OutputPanel pnlChild = new Component.Apex.OutputPanel(layout='block', style='page-break-before:always;'); Component.Apex.outputText txt = new Component.Apex.outputText(value=block, style='font-family:{!'+template.Font_Family__c+'}; width:100%', escape=false); pnlChild.childComponents.add(txt); pnlParent.childComponents.add(pnlChild);
}
return pnlParent; }