+ Start a Discussion
Rung41Rung41 

Help with VF Email layout

I am trying to remove white space from a VF email template created from line-breaks associated with conditional IF statements. If all the conditions are meet, the email spacing is fine. However, if none of the conditions are meet, the email renders with a large white space. Is there a better way to render the data?

Here is my IF Statement

{!IF(relatedTo.hardcover_formula__c == 'Yes',A, NULL)} <br /><br />
{!IF(relatedTo.hardcover_formula__c == 'Yes','B NULL)} <br />
{!IF(relatedTo.ship_to_formula__c == 'Other', C, NULL)}<br /><br /><br />

Thanks in advance!

Best Answer chosen by Rung41
SKSANJAYSKSANJAY
Hi Rung41,

You should use outputPanel to manage things instead of straight code in vf page. FYI
 
<apex:outputPanel rendered="{!If(relatedTo.hardcover_formula__c == 'Yes', true, false)}">
	Yes
	<br/>
	<br/>
</apex:outputPanel>
<apex:outputPanel rendered="{!If(relatedTo.ship_to_formula__c == 'Other', true, false)}">
	Yes
	<br/>
	<br/>
</apex:outputPanel>

Hope this will help you fix the issue. Let me know in case you need something else.

Thanks,
Sanjay
 

All Answers

SKSANJAYSKSANJAY
Hi Rung41,

You should use outputPanel to manage things instead of straight code in vf page. FYI
 
<apex:outputPanel rendered="{!If(relatedTo.hardcover_formula__c == 'Yes', true, false)}">
	Yes
	<br/>
	<br/>
</apex:outputPanel>
<apex:outputPanel rendered="{!If(relatedTo.ship_to_formula__c == 'Other', true, false)}">
	Yes
	<br/>
	<br/>
</apex:outputPanel>

Hope this will help you fix the issue. Let me know in case you need something else.

Thanks,
Sanjay
 
This was selected as the best answer
Rung41Rung41
Brillant! That did the trick. Thank you so much!!