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
Nina GonzalezNina Gonzalez 

Display alert with visual force page when two picklist fields are null

I am trying to display an alert with a visual force page when two picklist fields are null. Here is my code, which is not working:

<apex:page standardController="Lead" rendered="{!NOT(ISNULL(TEXT(Lead.Egg_Donor_Status__c)))} && {!NOT(ISNULL(TEXT(Lead.Sperm_Donor_Status__c)))} " >
 <script type="text/javascript">
     {
         window.alert("Please request that Client send a copy of their Donor Eligibility document.");
     }
 </script>

</apex:page>

I get the following error: 
Error: Donor_Eligibility_Paperwork_Alert line 1, column 96: Element type "apex:page" must be followed by either attribute specifications, ">" or "/>"
Error: Element type "apex:page" must be followed by either attribute specifications, ">" or "/>".

I am basing this code on a tip found here: https://developer.salesforce.com/forums/?id=906F000000097KLIAY 
Best Answer chosen by Nina Gonzalez
DeveloperSudDeveloperSud
Hi Nina,

There is some problem in the rendered attribute.As it seems the formual is not correct. If you use TEXT(Lead.Egg_Donor_Status__c) this will not work as the picklist field values are TEXT (String) only.You can see the below link for more reference .I think in rendered attribute you can use the below check :- rendered="{!NOT(ISNULL(Lead.Egg_Donor_Status__c))} && {!NOT(ISNULL(Lead.Sperm_Donor_Status__c))} " 
Please let us know if this works and mark it as solved if it helps.
https://developer.salesforce.com/forums/?id=906F00000008lnbIAA

All Answers

DeveloperSudDeveloperSud
Hi,

can you tell me the data type of these two fields Egg_Donor_Status__c and Sperm_Donor_Status__c ? Are those text fields?
Nina GonzalezNina Gonzalez
They are picklists.
DeveloperSudDeveloperSud
Hi Nina,

There is some problem in the rendered attribute.As it seems the formual is not correct. If you use TEXT(Lead.Egg_Donor_Status__c) this will not work as the picklist field values are TEXT (String) only.You can see the below link for more reference .I think in rendered attribute you can use the below check :- rendered="{!NOT(ISNULL(Lead.Egg_Donor_Status__c))} && {!NOT(ISNULL(Lead.Sperm_Donor_Status__c))} " 
Please let us know if this works and mark it as solved if it helps.
https://developer.salesforce.com/forums/?id=906F00000008lnbIAA
This was selected as the best answer
Nina GonzalezNina Gonzalez
Yes, that works. Thank you!