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
PzyrenPzyren 

Disable link if column is empty

I have a table and the columns have outputlinks. Right now, if the column is empty, it displays "None" which is a link to nowhere. I want to be able to remove the link if the column is empty.  Any help? Thanks

 

I tried 

 

<apex:outputLink value="/{!object.field__c}" )}" disabled = {!IF(!object.field__c == '')}    target="_top">  

 Obviously didn't work since disabled takes in boolean. 

 

<apex:column >
   <apex:facet name="header" ><apex:outputText value="{!$Label.Name}" /></apex:facet>
       <apex:outputLink value="/{!object.field__c}" )}" target="_top">  
       <apex:outputField value="{!object.field__c}" />
       </apex:outputLink>
 </apex:column>  

 

Best Answer chosen by Admin (Salesforce Developers) 
Saikishore Reddy AengareddySaikishore Reddy Aengareddy

Try

disabled = {! IF(ISBLANK(object.field__c),true,false)}

All Answers

Saikishore Reddy AengareddySaikishore Reddy Aengareddy

Try

disabled = {! IF(ISBLANK(object.field__c),true,false)}

This was selected as the best answer
TwanTwan

If you want to remove the link just use the rendered attribute of the apex:outputLink and add the condition inside it.