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
ArjunmcaArjunmca 

Rendered with multiple conditions

Hi,

 

I have to display a page message based on few conditions, but i have to use onlly one apex:pagemessage tag.

 

<Apex:PageMessage rendered="{!IsSignOnSuccess ||  !!IsSignOnSuccess &&!!IsValidUser }"  summary="Not a ValidUser" />

 

 

!IsSignOnSuccess true then summary =' SignonSucess'

!!IsSignOnSuccess && !!IsValidUser true then summary="Not a valid User"

 

I need to display both summary messages using only one apex:pagemessage tag. How to do that.

 

MTBRiderMTBRider

You would have more flexibility if you set the page message in the pages controller:

 

-- Your VF page --
<!-- Place this tag in the VF code where you want the message to show up -->
<apex:messages/>


--- Your Controller code --

String myMsg = 'Sign On Success';

if (!IsSignOnSuccess) {
   myMsg = 'Sign On Failed!';
} else if (!IsValidUser) {
   myMsg = 'Invalid User!';
} else {
myMsg = 'Oops! I am not sure what the error is but there was a problem!'
} ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, myMsg); ApexPages.addMessage(msg);