+ Start a Discussion
@GM@GM 

How to put condition in table row for Visualforce Template

I have to display this tr only when there is a value in EOL_Info__c field in VF TEmplate

but for the following code i'm getting sytax error and if i remove (!) before IF then it will get save but wont work.

<tr style="display: {!IF((ISBLANK({!relatedTo.PRM_EOL_Info__c})), 'none', 'table-row')};">
                    <td>EOL Info:</td>
                    <td>{!relatedTo.EOL_Info__c}</td>
</tr>

Please suggest some solution

Thanks in advance

Regards,
GM
Best Answer chosen by @GM
Vivek_PatelVivek_Patel
Hi GM,

Please try with below code, I have removed the expressions around relatedTo.PRM_EOL_Info__c field. That is not needed if you have already started the expression.

<tr style="display: {!IF((ISBLANK(relatedTo.PRM_EOL_Info__c)), 'none', 'table-row')};">
                    <td>EOL Info:</td>
                    <td>{!relatedTo.EOL_Info__c}</td>
</tr>

Regards,
Vivek Patel

Please mark this best answer if it solves you problem.
 

All Answers

Vivek_PatelVivek_Patel
Hi GM,

Please try with below code, I have removed the expressions around relatedTo.PRM_EOL_Info__c field. That is not needed if you have already started the expression.

<tr style="display: {!IF((ISBLANK(relatedTo.PRM_EOL_Info__c)), 'none', 'table-row')};">
                    <td>EOL Info:</td>
                    <td>{!relatedTo.EOL_Info__c}</td>
</tr>

Regards,
Vivek Patel

Please mark this best answer if it solves you problem.
 
This was selected as the best answer
@GM@GM
Hi Vivek,

Thanks.

Regards,
GM