15

I was wondering if there's a way to display a link in an ApexPages.Message. There's nothing mentioned in the documentation about it, so I simply did a :

ApexPages.Message(ApexPages.Severity.CONFIRM, '<a href="/">test</a>');

It seems like the special characters are transformed to their html entity, making the link unusable.

Any known workaround?

1 Answer 1

26

You may need to set escape parameter to false in your VF page.

<apex:pageMessages escape="false"/> 
2
  • Super cool, never heard of that attribute. Working surprisingly well :D! Thanks @richard-n
    – jpmonette
    Feb 25, 2013 at 17:56
  • 5
    Note that this means any HTML included in your ApexPages.Message objects will be rendered as HTML in the page, and if you have to undergo security review you may be asked to justify this choice. Feb 26, 2013 at 1:44

You must log in to answer this question.

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