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
deepakMdeepakM 

How to make opportunity name clickable in Visualforce page.

HI community.

 

I have one vf page related to custom object ff having Opportunity as a Master-Detail(Opportunity).

in vf page i have one inputtag as below

    <apex:inputField label="Opportunity" value="{!FF__c.Opportunity__c}"  />

 

during create ,textbox is open for opportunity abd during edit the readonly field,so in this cas i need it to a click able and redirect to opportunity page.
 
As i have one action in controller which work perfectly but i need it in opportunity case in edit mode.
 
 
Thanks
Best Answer chosen by Admin (Salesforce Developers) 
deepakMdeepakM

hi 

 

i got the solution below.it work f9 fro me.

 

<apex:inputField label="Opportunity" value="{!FF__c.Opportunity__c}" onclick="myJavascriptFunc() ;"/>

<apex:actionFunction name="CallApexMethod" action="{!Cancel}"/>

<script>
function myJavascriptFunc()
{
CallApexMethod() ;
}
</script>

All Answers

Gunners_23Gunners_23

Use can embed the field within <apex:outputLink>. That should do fine.

deepakMdeepakM

hi 

 

i got the solution below.it work f9 fro me.

 

<apex:inputField label="Opportunity" value="{!FF__c.Opportunity__c}" onclick="myJavascriptFunc() ;"/>

<apex:actionFunction name="CallApexMethod" action="{!Cancel}"/>

<script>
function myJavascriptFunc()
{
CallApexMethod() ;
}
</script>

This was selected as the best answer