You need to sign in to do that
Don't have an account?
Ritik
copy mailing address to other address in Contact EditDetail page
Hi,
I am trying to replicate Contact EditDetail page with my visualforce page.
Here I am unable to put the standard functionality of the link "copy mailing address to other adderess"
Can anybody help regarding this?
I'm using standard controller for displaying fields.
Thanks in Advance!
R_Shri
I am trying to replicate Contact EditDetail page with my visualforce page.
Here I am unable to put the standard functionality of the link "copy mailing address to other adderess"
Can anybody help regarding this?
I'm using standard controller for displaying fields.
Thanks in Advance!
R_Shri
<apex:form >
<apex:pageBlock title="Contact Edit" id="test">
<apex:pageBlockButtons location="both">
<apex:commandButton value="Save" action="{!Save}"/>
<apex:commandButton value="Save & New" />
<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Contact Information">
<apex:inputField value="{!contact.FirstName}"/>
<apex:inputField value="{!contact.LastName}"/>
</apex:pageBlockSection>
<apex:commandLink value="Copy Malling Address to Other Address" style="float:right;" action="{!test}" reRender="test"/>
<apex:pageBlockSection title="Address Information" >
<apex:inputField value="{!contact.MailingCountry}"/>
<apex:inputField value="{!contact.otherCountry}"/>
<apex:inputField value="{!contact.MailingStreet}"/>
<apex:inputField value="{!contact.otherStreet}"/>
<apex:inputField value="{!contact.MailingState}"/>
<apex:inputField value="{!contact.otherState}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public with sharing class contactEditPageExtension {
public Contact contact{get;set;}
public contactEditPageExtension(ApexPages.StandardController controller) {
//this.contact = (Contact )controller.getRecord();
contact = new Contact();
}
public void test(){
contact.otherCountry = contact.MailingCountry;
contact.otherState = contact.MailingState;
contact.otherStreet = contact.MailingStreet;
//return null;
}
}
All Answers
<apex:form >
<apex:pageBlock title="Contact Edit" id="test">
<apex:pageBlockButtons location="both">
<apex:commandButton value="Save" action="{!Save}"/>
<apex:commandButton value="Save & New" />
<apex:commandButton value="Cancel" action="{!Cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Contact Information">
<apex:inputField value="{!contact.FirstName}"/>
<apex:inputField value="{!contact.LastName}"/>
</apex:pageBlockSection>
<apex:commandLink value="Copy Malling Address to Other Address" style="float:right;" action="{!test}" reRender="test"/>
<apex:pageBlockSection title="Address Information" >
<apex:inputField value="{!contact.MailingCountry}"/>
<apex:inputField value="{!contact.otherCountry}"/>
<apex:inputField value="{!contact.MailingStreet}"/>
<apex:inputField value="{!contact.otherStreet}"/>
<apex:inputField value="{!contact.MailingState}"/>
<apex:inputField value="{!contact.otherState}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
public with sharing class contactEditPageExtension {
public Contact contact{get;set;}
public contactEditPageExtension(ApexPages.StandardController controller) {
//this.contact = (Contact )controller.getRecord();
contact = new Contact();
}
public void test(){
contact.otherCountry = contact.MailingCountry;
contact.otherState = contact.MailingState;
contact.otherStreet = contact.MailingStreet;
//return null;
}
}
Thanks for your response.
Also I have found a solution for replicating the data by using JavaScript. Below is the source website for the same.
http://writeforce.blogspot.in/2013/01/building-visualforce-pages-for-standard_21.html
R_Shri