2

How to add hyperlink in apexpage.message() in apex class? I got some solution link but it is displaying the message on the top of the visual force page. I want message in some division/section of page. Does anybody know anything about this. Please point me.

Thanks in advance!

2

You can achieve it in a very simple way just using an apex:pageMessage tag and place it anywhere on the page:

<apex:pageMessage severity="warning" escape="false" summary="Summary text" strength="2" title="Message title text">
    <a href="#">The link test</a>
</apex:pageMessage> 

The result:

enter image description here

If you have to conditionally render the message on the page you will have to define an apex boolean variable ant put it into the rendered="{!yourVariable}" parameter.

1

If you can put <apex:pageMessages escape="false"/> in apex pageblock, outputpanel etc. then if will be visible in there as well. You will need to rerender that section e.g. PageBlock.

    <apex:pageBlock title="Attendances" mode="edit" id="rerender_id">
       <apex:pageBlockSection title="Details" columns="2">
                  <apex:pageBlockSectionItem >
                         <apex:pageMessages escape="false"/>
                  </apex:pageBlockSectionItem>
      </apex:pageBlockSection>
    </apex:pageBlock>

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.