+ Start a Discussion

Rendered with multiple conditions



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.



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 -->

--- 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);