+ Start a Discussion
Ty WhitfieldTy Whitfield 

Apexpages.messages not displaying in classic

This is strange.  I have apex:messages that work correctly in Lightning, however, in Classic they do not show.  After some researching, I tried putting the messages in an outputText.  But then it doesn't render with the set styling.  So for example, it renders the text in white but if I set it to black, red or any other color, it just ignores it and still puts it in white.  Any ideas?  Below are code snippets.
 
<div >
 <apex:Messages style="color:white;font-size:1.3em;font-weight:bold"/>

 <apex:outputText rendered="errorStatus" style="color:#ff0606;" value="{!errorMsg}" id="msg"/>


 </div>
 
if(Opp.StageName != 'Closed Won')
        {
            stageStatus = Opp.StageName;
            pageStatus = false;
            errorStatus = true;
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'The opportunity has not been won yet. You must mark the opportunity as Closed Won before finalizing it!'));
            errorMsg = 'The opportunity has not been won yet. You must mark the opportunity as Closed Won before finalizing it!';
        }

 
SandhyaSandhya (Salesforce Developers) 
Hi,

Try below code
 
<div >
 <apex:Messages style="color:white;font-size:1.3em;font-weight:bold"/>

    <font color="red">
 <apex:outputText rendered="errorStatus" value="{!errorMsg}" id="msg"/>
    </font>


 </div>

Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya