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
abivenkatabivenkat 

<Apex:pageMessages> tag

 

hi all,

 

i am using the <apex:pageMessages> tag in my VisualForce page to display the errors and warnings. my need is,

Is it possible to apply styling for the error messages populated by this tag?

 

how to apply style for the error messages, such as, my error message should be block letters and red in color. how to achieve this??? please help

 

thanks,

abivenkat,

SFDC Learner

bob_buzzardbob_buzzard

I'm not aware of any way to style this from the component itself.  You may be able to do one of the following;

 

(1) View the source of the page with error message rendered, identify the name of the style and override this in your page with an style block.

(2) Change the stying after the page is rendered via javascript.

 

Bear in mind that both of these are fragile, in that if Salesforce change the style names of the elements, your page will suddenly revert to the standard.

abivenkatabivenkat

 

hi bob_buzzard,

 

There is some problem in viewing my page's source once after the error is caused. i can able to view my page source before the error occurs, but, cant able to view it after the error is caused. so i cant and dint try ur first option. 

 

can u give any suggestion on the second suggestion? any javascript example which runs once the page is rendered??

 

i also tried another way by changing the styling using the "Firebug" tool in the mozilla firefox, but it is changing all the labels in the current page.. please help me in this...

 

 

thanks,

abivenkat

SFDC Learner

bob_buzzardbob_buzzard

I don't have a javascript example I'm afraid - I don't use this mechanism for the reasons I outlined.  When I need custom error messaging of this nature I usually roll my own solution - i.e. generate custom error information in the controller and render it using my own styling.