You need to sign in to do that
Don't have an account?
PS81
Lookup field event handler
Hi
I have a lookup field declared as below:
<apex:inputfield value="{!Product2.Opportunity__c}" id="prodoppr"/>
wish to know how to add or handle event for this lookup field? When there is a change in the value I want to trigger method to perform certain validation and upate other fields....how can i achieve this? please any inputs?
I have a lookup field declared as below:
<apex:inputfield value="{!Product2.Opportunity__c}" id="prodoppr"/>
wish to know how to add or handle event for this lookup field? When there is a change in the value I want to trigger method to perform certain validation and upate other fields....how can i achieve this? please any inputs?
check this for more detail about action support https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_actionSupport.htm
All Answers
For custom logic implementation on selection of Opporutnity, write a trigger as below on Product2 object:
I'm using a custom VF page and with reference to it writting a trigger will not have the validations happening online. Handling events and triggers are not the same and i wish to write a event handler that would work online somehting like client-server interaction so that i can write code to have other fields updated as required,
check this for more detail about action support https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_actionSupport.htm
i have the below in my VF page:
<apex:inputfield value="{!Opportunity.StageName}" >
<apex:actionSupport id="oprstage" event="onchange" action="{!setProbability}" rerender="form" immediate="TRUE" />
</apex:inputfield>
in my controller:
public with sharing class OpportunitySave {
public string probability {get;set;}
public Opportunity opr {get;set;}
public OpportunitySave(ApexPages.StandardController controller) {
}
public PageReference setProbability(){
}
}
Not sure how I can refer the value from StageName and update other field 'Probability' (text field) in opportunity...any inputs on this pleasE?