+ Start a Discussion
asapjimasapjim 

conditional br tag in visual force email template

Hi I am conditionally trying to add a br tag to a visual force email template, and I can't get around the html encoding.

 

I'm trying to avoid blank lines in an address block, so if optional address elements are not present i don't want to insert a break.

 

Here's what I am trying to do

 

{!relatedTo.Shipping_Address_2__c}{!if(relatedTo.Shipping_Address_2__c =='','','<br />')}

 

I've tried using HTMLENCODE around br tag but I still come up with &lt

 

Is there a better way to approach this?  I'm sure this a fairly common requirement.

 

Thanks!

S91084S91084

Hi You can use <apex:outputText/> tag to insert a break

 

Try the following way:

 

{!relatedTo.Shipping_Address_2__c}<apex:outputText escape="false" value="<br/>" rendered="{!relatedTo.Shipping_Address_2__c!=''}"/>