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
@taani.ax1426@taani.ax1426 

Mapping of field in lookup

Hi,

 

I made one VF page, code given below. My requirement is when user select any record from look up(Site_Address__c), the value of some field from Site address should map to some fields in Contact, as "Street"which is in Street Adress, should populate in "Mailing Street" of contacts. I dont want this when user save the record(as it can be done by trigger), I want as soon user chose any record, correspond to that record value should populate.(By onchange).

 

Can any one provide me soln for this with sample code?

 

<apex:page standardController="Contact" >

    <apex:form >
        <apex:pageBlock >

                    <apex:pageBlockSection title="Address Information" columns="2">
                    <apex:outputPanel layout="block"> 
                    <label for="checkbox">Select address from existing address </label> 
                    <input id="checkbox" type="checkbox"/> 
                    </apex:outputPanel>
                     <apex:inputField value="{!contact.Site_Address__c}" />                   

                     

                               
                <apex:inputField value="{!Contact.MailingStreet}"/>
                <apex:inputField value="{!Contact.MailingCity}"/>
                <apex:inputfield value="{!Contact.MailingState}"/>
                <apex:inputfield value="{!Contact.MailingPostalCode}"/>
                <apex:inputfield value="{!Contact.MailingCountry}"/>
               
                                             


                            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

Thanks

Hengky IlawanHengky Ilawan

I think you can use javascript remoting call from the Site_Address__c lookup and populate those fields.

@taani.ax1426@taani.ax1426

pls provide sample code for this...

 

Thanks

Hengky IlawanHengky Ilawan

Hi @taani,

 

There is a good example from salesforce documentation

http://www.salesforce.com/us/developer/docs/pages/Content/pages_js_remoting_example.htm

 

Regards,

Hengky