• Prashanth_SFDC
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hello All,

 

I've been trying to come up with a way of doing the following and have so far been unsuccessful. Onchange of a lookup field I would like to assign the value of the Id to a string in the controller and perform an action method to rerender another section of the page based on that value. This is not what I am trying to do but is a very straight forward example of what I am trying to accomplish.

APEX Class

public string ContactId {get;set;}

 

public string getContactEmail(){

string ContactEmail = [Select Email from Contact where Id=: ContactId].Email;

return ContactEmail;

-----------

VF Page

 

<apex:inputfield value="{!Form__c.Contact__c}">

 

In this example I would like to assign the Id value of the contact from the Form__c.Contact__c inputfield to the ContactId string in the controller when the lookup field is changed. I have tried using javascript to acheive the lkid value of this field and several other ways with no success. Anyone have any ideas of assigning the Id value of a lookup field to a string on change without turning the lookup field into a select list (over 1000 records return so this is not an option). ?