+ Start a Discussion
LudivineLudivine 

rendered null date

Dear all,

I want to display a date field on my contract page only when this date is not null.
But something is wrong in the rendered statement, It displays an error message instead of nothing when the date is null :

Content cannot be displayed : The value "null" is not valid for operator '<='

My Visualforce page :

<apex:page sidebar="false" standardController="Contract" rendered="{!AND(contract.Reminder_Date__c<=today(),contract.Contract_Extension_Date__c<=null)}">
<font color="#595959" size="2"> <b>Contract Extension date</b> &nbsp;&nbsp;&nbsp; </font>
<apex:outputfield value="{!contract.Contract_Extension_Date__c}" />
</apex:page>



Any ideas?
Thanks,
Ludivine
Best Answer chosen by Ludivine
shiv@SFDCshiv@SFDC
Please try this...
<apex:page sidebar="false" standardController="Contract" rendered="{! if(contract.Contract_Extension_Date__c !=null,(contract.Reminder_Date__c<=today()),false)}">
<font color="#595959" size="2"> <b>Contract Extension date</b> &nbsp;&nbsp;&nbsp; </font>
<apex:outputfield value="{!contract.Contract_Extension_Date__c}" />
</apex:page>

Please mark asnser as solution if it resolve your issue.

All Answers

PratikPratik (Salesforce Developers) 
Hi Ludivine,

To compare the value with null you can write like :

rendered="{!IF(ISNULL(contract.Contract_Extension_Date__c),true,false)}"

Please refer to posts:
https://developer.salesforce.com/forums/ForumsMain?id=906F000000097R5IAI
https://developer.salesforce.com/forums/ForumsMain?id=906F000000097JiIAI

Thanks,
Pratik

P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.

shiv@SFDCshiv@SFDC
Please try this...
<apex:page sidebar="false" standardController="Contract" rendered="{! if(contract.Contract_Extension_Date__c !=null,(contract.Reminder_Date__c<=today()),false)}">
<font color="#595959" size="2"> <b>Contract Extension date</b> &nbsp;&nbsp;&nbsp; </font>
<apex:outputfield value="{!contract.Contract_Extension_Date__c}" />
</apex:page>

Please mark asnser as solution if it resolve your issue.
This was selected as the best answer
LudivineLudivine
Thank you and for the quick help!! it works!! wonderful