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

"OutputField" link in visualforce page issue. Open a "NEW" tab or

I have a visualforce page that is a lookup field value.  Works great and blends with the visualforce page.  

VF Field:
User-added image

VF Code:

<apex:outputLabel value="Relationship" for="Proposal__c.Relationship__c" style="font-weight:bold"/>
<apex:outputField value="{!Proposal__c.Relationship__c}" id="Proposal"/>

The problem I'm having is when I click on the link it opens inside that iFrame.  How can I solve the issue without using a Outputlink? And let it load a new page or a new tab.  I can use an output link because I need ti be able to modify that field data.

User-added image

Thanks you guys

DeepthiDeepthi (Salesforce Developers) 
Hi Jon,

You can work around using the commandLink. Please check the below link that explains with an example.

Best Regards,
Mahesh DMahesh D
Hi Jon,

I don't think it is possible with a standard visualforce.
One workaround is to catch the click event on all anchor (a) tags that are wrapped with an element with a certain css class and "redirect" the link target to the new window/tab. For example:

    jQuery(document).ready(function() {
        jQuery('.openInPopup a').click(function(event) {

<apex:outputPanel layout="block" styleClass="openInPopup">
    <apex:pageBlock mode="edit">
            <apex:outputField value="{!a.CreatedById}"/>

  document.getElementById('{!$Component.ownerId}').target = "_blank";

Please do let me know if it helps you.