14

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?

24

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

<apex:pageMessages escape="false"/> 
  • Super cool, never heard of that attribute. Working surprisingly well :D! Thanks @richard-n – jpmonette Feb 25 '13 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. – ca_peterson Feb 26 '13 at 1:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.