+ Start a Discussion
clouddev@surashriclouddev@surashri 

Disable Lookup field hyperlink but keep lookup functionality

Hi,

I am creating a visualforce page on opportunity. I am refering 4 lookup fields in this page. I am inserting this page in opportunity page layout. The page looks as

User-added image

The visualforce code section for Teleasales Partner is

<apex:pageBlockSectionItem id="section1" >
<apex:outputLabel value="Telesales Partner" for="tp_id" />
<apex:panelGroup >
  <apex:outputField value="{!opportunity.Telesales_Partner__c}" id="tp_id">
   <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
  </apex:outputField>
  <apex:outputLabel value="Commission Applicable? " for="tp_id2" style="font-weight:bold;font-family:Arial,Helvetica,sans-serif;" />
  <apex:inputField value="{!opportunity.Telesales_Partner_Commission_Flag__c}" id="tp_id2" onchange="selectFlag()">
  </apex:inputField>
</apex:panelGroup>
</apex:pageBlockSectionItem>

How can I disable link to lookup field but need to keep look up functionality. I want to disable link becase link opens record in page layout section as
User-added image

which I don't need ?

Could you please help ? Let me know if you need more details

Thanks,

clouddev@surashri
Ramu_SFDCRamu_SFDC
The following post might help 

http://stackoverflow.com/questions/9101678/removing-the-link-from-a-visualforce-lookup-field-output
Atul Thakur 16Atul Thakur 16
Hi @clouddev@surashri

If you got the answer of this query Please share 

Thanks
Atul
LakshmanLakshman
For this you might want to use jQuery, like for your example add a styleclass to your inputfield "openInPopup" and below should work-
 
<script>
    jQuery(document).ready(function() {
        jQuery('.openInPopup a').click(function(event) {
            event.preventDefault();
            window.open(jQuery(this).attr('href'));
        });
    });    
</script>

Thums up if it helps.