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
NalinakuNalinaku 

How to display message along with hyperlinked url in VF page

Hi All, 
I have a requirement to display a message on checking a checkbox, which contains an URL in the end, which needs to be hyperlinked. I am able to display the message with the custom label now, which is not hyperlinked, below is the code sample. I have to make only the URL part hyperlinked clicking on which should follow and open the url page. 
 
<apex:page standardController="Contact">
<apex:form >

<apex:pageBlock id="theBlock">
<apex:pageBlockSection columns="1">
                    <apex:inputField label="checkboxfield" value="{!Contact.CheckboxValue }">
                        <apex:actionSupport event="onchange" reRender="theBlock" status="status"/>
                    </apex:inputField>

 
  <apex:OutputText value="{!$Label.Mylabelmessage}" rendered="{!(Contact.checkboxfield == true)}"/> 
  </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

Kindly let me know if I can achieve the hyperlinking only part of the message. 
Raj VakatiRaj Vakati
TRy like this
 
<apex:page standardController="Contact">
    <apex:form >
        
        <apex:pageBlock id="theBlock">
            <apex:pageBlockSection>
                <apex:inputCheckbox  label="checkboxfield" value="{!Contact.Demo__c }">
                    <apex:actionSupport event="onchange" reRender="theBlock" status="status"/>
                    
                </apex:inputCheckbox>
                <apex:outputLink  value="{!$Label.Mylabelmessage}" rendered="{!(Contact.Demo__c == true)}">{!$Label.Mylabelmessage}</apex:outputLink> 
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
NalinakuNalinaku
Thanks for the response Raj. This approach makes the entire Label hyperlinked, but I need to make part of the message hyperlinked.

here is the example below. 

For any Salesforce related queries please visit https://developer.salesforce.com/