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
TheCustomCloudTheCustomCloud 

How come Rendered != null doesnt seem to work with date fields?

I am displaying two dates (a from and to date) like this, 8/8/2011 to 8/10/2011.  If no to date is entered then I do not want to display the " to " text.  

 

 

I am using a simple outputText like below but it does not work:

 

<apex:outputText value=" to " rendered="{!Account.To__c != null}"/>

 

 

I used the same code but with a text field and had no problems:

 

<apex:outputText value=", {!Account.Name}" rendered="{!Account.Name != null}"/>

 

 

Any ideas?

 

Best Answer chosen by Admin (Salesforce Developers) 
Ankit AroraAnkit Arora

I tried this in multiple ways and here are the solutions without any typo :)

 

<apex:outputText value=" to " rendered="{!IF(ISNULL(Account.To__c) , false , true)}"/>

 

<apex:outputText value=" to " rendered="{!IF(Account.To__c != null , true , false)}"/>

 

<apex:outputText value=" to " rendered="{!IF(ISBLANK(Account.To__c) , false , true)}"/>

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

All Answers

Shashikant SharmaShashikant Sharma

Use it like this

 

<apex:outputText value=" to " renrendered="{!IF(ISNULL(Account.To__c) , false , true)}"/>

 It will work for you for date also.

Ankit AroraAnkit Arora

I tried this in multiple ways and here are the solutions without any typo :)

 

<apex:outputText value=" to " rendered="{!IF(ISNULL(Account.To__c) , false , true)}"/>

 

<apex:outputText value=" to " rendered="{!IF(Account.To__c != null , true , false)}"/>

 

<apex:outputText value=" to " rendered="{!IF(ISBLANK(Account.To__c) , false , true)}"/>

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

This was selected as the best answer