+ Start a Discussion
kjpetersonkjpeterson 

Messages component doesn't identify message severity?

Is there some way I can use ApexPages.addMessage and have the apex:messages component render messages with some kind of severity indicator?

Imran MohammedImran Mohammed

Yes, you can do that and the messages tag will show the message along with the severity.

Add the below line to your controller.

ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.error, your message here)).

Then rerender the apex:messages tag using its id(ex: msg).

<apex:messages id="msg"/>

 

There are different values for the severity like

Info

Error

Confirm

Warning

Fatal

 

 

 

kjpetersonkjpeterson

When using the messages component all that is rendered is an unordered list with none of the li's having any specials classes or icons to identify severity.

 

Here is an example:

 

 

<ul id="j_id0:formQA:pbQA:msgs">
<li>Warning severity message</li>
<li>Confirm severity message</li>
</ul>

 

 

kjpetersonkjpeterson

Imran did I miss something in your reply?  I am not seeing any kind of indication as to what the severity is when using the messages (plural) component.

 

Can you confirm?