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
sflearnsflearn 

Apex messages question

When should I use apex:message vs apex:messages vs  apex:pageMessage and apex:pageMessages? I read the docs but its very confusing

Venkat PolisettiVenkat Polisetti

<apex:messages/> and <apex:pageMessages/> are the same for all practical purposes except that the <apex:pageMessages> are shown with SF default styling and you cannot style them. <apex:Messages> can be styled to your liking using your own styles.

 

The same info applies to <apex:message> and  <apex:pagemessage>.

 

Here is an example of <apex:pageMessage>:

 

 

<apex:pageMessage summary="This Opportunity is currently synced with any Quote." severity="warning" strength="3" rendered="{!isNotSyncing}" />
sflearnsflearn
Thanks for clarifying- very helpful. Question I have is what than is the diff between apex:message vs apex: messges and apex:PageMessage vs apex:pageMessages?
sflearnsflearn

when i clicked the link it says the page doesn';t exist

swatKatswatKat

Okay its something like this:

 

apex:PageMessages is a containing component where any messages that have been added to the page will appear.

 

apex:pageMessage is a component that adds a single message to the page.