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
GobbledigookGobbledigook 

Reference Lookup field in Visualforce page

Hey all,

 

I'm trying to work on a visualforce change that will rerender a pageblock with associated contacts whenever an account is modified in the lookup field. 

In other words, when an account is changed, the appropriate contacts should be displayed (to work with them later). 

 

I have the inputField displaying the Account lookup, but it's not changing on a change.  I tried using onchange... didn't work.  I just need to reference the account lookup within my standard controller and work with a rerendered.  Can anyone help out?

 

Code:

<Apex:inputField value="{!Call_Attendee__c.Attendee_Account__c}" onchange="Do Something"/>

 

 

SargeSarge

 

Hi,

 

    If I understand your requirement perfectly, I think you need to dislplay related contact records of the currently selected Account in a lookup in the same edit page. The list of contacts, I would assume, will be displayed in a picklist or so.

If so, try using <apex:actionSupport/> tag in following way

 

 

<apex:inputField value="{!Call_Attendee__c.Attendee_Account__c}" >
<apex:actionSupport event="onchange" action="{!yourMethodInApexClass}" reRender="panel_where_picklist_is_present"/>
</apex:inputField>

 

 

the method in apex class will fetch contacts related to account you just selected.