How can we display apex:pagemessages as a pop up modal in a Visualforce Page instead of the standard error message behavior?

 ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM, 'Confrim'));

I want to display it as below -

Basic dialog


1 Answer 1


Basically, you can follow the method posted in Eric's answer in this post: How to convert a Visualforce apex:pageMessages to be lightning style

In this post, Eric has changed the style into slds style. But pretty much you can change it into any style you want in your VF page.

What you need to do is to stop using ApexPages.addMessage and have several attributes to handle the message content and message type. And then display based on that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .