• sanjay dubey 19
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 2
    Replies
<apex:page controller="wrappersanjay">
  <script type="text/javascript">
        function selectAllCheckboxes(obj,receivedInputID){
            var inputCheckBox = document.getElementsByTagName("input");
            for(var i=0; i<inputCheckBox.length; i++){
                if(inputCheckBox[i].id.indexOf(receivedInputID)!=-1){
                    inputCheckBox[i].checked = obj.checked;
                }
            }
        }
    </script>
    <apex:form >
        <apex:pageBlock >
        <apex:commandButton value="selected contact" action="{!processSelected}"/>
            <apex:pageBlockSection columns="2">
                <apex:pageBlockTable value="{!wrplist}" var="wr">
                 <apex:column >
                        <apex:facet name="header">
                            <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                        </apex:facet>
                        <apex:inputCheckbox value="{!wr.checkbox}" id="inputId"/>
                    </apex:column>
                    <apex:column value="{!wr.con.lastName}" />
                    <apex:column value="{!wr.con.firstname}" />
                    <apex:column value="{!wr.con.phone}" />
                    </apex:pageblocktable>
                    <apex:pageBlockTable value="{!conlist}" var="c" id="table2" title="Selected Accounts">
                    <apex:column value="{!c.lastname}" headerValue="Account Name"/>
                    <apex:column value="{!c.firstname}" headerValue="Billing State"/>
                    <apex:column value="{!c.Phone}" headerValue="Phone"/>
                </apex:pageBlockTable>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>


public class wrappersanjay {
    public List<wrapper100> wrplist {get;set;}
   
    public list<contact> conlist{get;set;}
     
    public wrappersanjay(){
       
        if(wrplist == null){
            wrplist = new list<wrapper100>();
            for(contact c : [select id,lastname,firstname,phone from contact limit 10]){
               wrplist.add(new wrapper100(c));
               system.debug('%%%%%%%%%'+wrplist);
               system.debug('#######'+c);
            }
        }  
    }
        public void processSelected(){
            conlist = new list<contact>();
            
            for(Wrapper100 wrpobj : wrplist){
                if(wrpobj.checkbox == true){
                    conlist.add(wrpobj.con);
                }
            }
        }
    
    public class wrapper100{
    public contact con{get;set;}
    public Boolean checkbox{get;set;}
    
    public wrapper100(contact c){
        contact con=c;
        checkbox = false;
    }
    }
}
please provide step by step instruction for paypal integration with salesforce
hello friends 
i have generated xml for account rocord but my requirement is that when user click on a button the generated xml will download in local machine 
please suggest me 
my vf page 

<apex:page Controller="AllAccount"contentType="application/xml" readOnly="true" showHeader="false" sidebar="false" cache="false">
<?xml version="1.0" encoding="UTF-8" ?>    
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://nsi.dk/-/stamdata/3.0/dkma" targetNamespace="http://nsi.dk/-/stamdata/3.0/dkma">
<xs:element name="DEXFileUpload" type="DEXFileUpload">
   <xs:complexType name="DEXFileUpload">
     <xs:all>
     <apex:repeat value="{!TheAccount}" var="eachAccount" >
     <xs:choice minOccurs="1" maxOccurs="5"/>
    <Account>
    <xs:complexType name="Account Basic information">
        <xs:sequence>
            <xs:element name="{!eachAccount.name}" type="{!eachAccount.type}"/>
            <xs:element type="{!eachAccount.type}"/>
            <xs:element Fax= "{!eachAccount.Fax}"/>
            <xs:element Industry= "{!eachAccount.Industry}"/>
            <xs:element AnnualRevenue= "{!eachAccount.AnnualRevenue}"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Address information">
    <xs:sequence>
       <xs:element billingcity= "{!eachAccount.billingcity}" maxOccurs="unbounded" minOccurs="0"/>
       <xs:element billingcity= "{!eachAccount.billingCountry}"/>
    </xs:sequence>
    </xs:complexType>
    </Account>
      </apex:repeat>
      </xs:all>
   </xs:complexType>
 </xs:element>
</xs:schema>
</apex:page>
  

controller

 public class AllAccount {

    public List<Account> getTheAccount() {
       List<Account> theAllAccount = 
            [SELECT Name,type,AnnualRevenue,billingcity,BillingCountry,Fax,Industry FROM Account];
        return(theAllAccount);
    }
}

that produce the output this 

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<xs:schema xmlns:tns="http://nsi.dk/-/stamdata/3.0/dkma" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://nsi.dk/-/stamdata/3.0/dkma">
<xs:element name="DEXFileUpload" type="DEXFileUpload">
<xs:complexType name="DEXFileUpload">
<xs:all>
<xs:choice maxOccurs="5" minOccurs="1"/>
<Account>
<xs:complexType name="Account Basic information">
<xs:sequence>
<xs:element name="test Household" type="Household"/>
<xs:element type="Household"/>
<xs:element Fax=""/>
<xs:element Industry=""/>
<xs:element AnnualRevenue=""/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Address information">
<xs:sequence>
<xs:element billingcity="" maxOccurs="unbounded" minOccurs="0"/>
<xs:element billingcity=""/>
</xs:sequence>
</xs:complexType>
</Account>
</xs:schema>
my requirement is that when i click on button it downloaded .

thanks in advance 
sanjay 
my requirement is that when user click on generate xml button the account data downloads in xml format like below

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:cd="urn:cd-schema" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="DEXFileUpload" type="DEXFileUpload" />
  <xs:complexType name="DEXFileUpload">
    <xs:choice minOccurs="1" maxOccurs="5">
      <xs:element name="Clients" type="Clients" maxOccurs="1"/>
      <xs:element name="Sessions" type="Sessions"  maxOccurs="1"/>
      <xs:element name="SessionAssessments" type="SessionAssessments"  maxOccurs="1"/>
      <xs:element name="Outlets" type="Outlets"  maxOccurs="1"/>      
    </xs:choice>
  </xs:complexType>
  <xs:complexType name="Clients">
    <xs:sequence>
      <xs:element name="Client" type="Client" maxOccurs="unbounded" minOccurs="1"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Sessions">
    <xs:sequence>
      <xs:element name="Session" type="Session" maxOccurs="unbounded" minOccurs="1"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Outlets">
    <xs:sequence>
      <xs:element name="Outlet" type="Outlet" maxOccurs="unbounded" minOccurs="1"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Client">
    <xs:sequence>
      <xs:element name="ClientId" type="NonEmptyString"/>
      <xs:element name="ConsentToProvideDetails" type="xs:boolean" />
      <xs:element name="ConsentedForFutureContacts" type="xs:boolean" />
      <xs:element name="GivenName" type="NonEmptyString" nillable="true" minOccurs="0" />
      <xs:element name="FamilyName" type="NonEmptyString" nillable="true" minOccurs="0" />
      <xs:element name="IsUsingPsuedonym" type="xs:boolean" />
      <xs:element name="BirthDate" type="xs:date" />
      <xs:element name="IsBirthDateAnEstimate" type="xs:boolean" />
      <xs:element name="GenderCode" type="NonEmptyString" />
      <xs:element name="CountryOfBirthCode" type="NonEmptyString" />
      <xs:element name="LanguageSpokenAtHomeCode" type="NonEmptyString" />
      <xs:element name="AboriginalOrTorresStraitIslanderOriginCode" type="NonEmptyString" />
      <xs:element name="HasDisabilities" type="xs:boolean" />
      <xs:element name="Disabilities" nillable="true" minOccurs="0">
     
        <xs:complexType>
          <xs:sequence>
            <xs:element name="DisabilityCode" type="NonEmptyString" maxOccurs="unbounded" minOccurs="1"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="AccommodationTypeCode" type="NonEmptyString" minOccurs="0" />
      <xs:element name="DVACardStatusCode"  type="NonEmptyString"  minOccurs="0"/>
      <xs:element name="HasCarer" nillable="true" type="xs:boolean"  minOccurs="0" />
       </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Session">
    <xs:sequence>
      <xs:element name="SessionId" type="NonEmptyString" />
      <xs:element name="CaseId" type="NonEmptyString" />
      <xs:element name="TotalNumberOfUnidentifiedClients" type="MaxUnidentifiedClients"/>
      <xs:element name="FeesCharged" type="MinFeesCharged" nillable="true" minOccurs="0" />
      <xs:element name="InterpreterPresent" type="xs:boolean" nillable="true" minOccurs="0"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Outlet"></xs:complexType>
  <xs:complexType name="ResidentialAddress">
    <xs:sequence>
      <xs:element name="AddressLine1" type="NonEmptyString" nillable="true" minOccurs="0" />
      <xs:element name="Suburb" type="NonEmptyString" />
      <xs:element name="StateCode" type="NonEmptyString" />
      <xs:element name="Postcode" type="PostCodeString" />
    </xs:sequence>
  </xs:complexType>
    <xs:simpleType name="NonEmptyString">
    <xs:restriction base="xs:string">
      <xs:minLength value="1" />
      <xs:pattern value=".*[^\s].*" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="PostCodeString">
    <xs:restriction base="xs:string">
      <xs:minLength value="4" />
      <xs:maxLength value="4" />
      <xs:pattern value="^[\d]{4}$" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="MaxUnidentifiedClients">
    <xs:restriction base="xs:integer">
      <xs:maxInclusive value="999" />
      <xs:minInclusive value="0" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="MinFeesCharged">
    <xs:restriction base="xs:decimal">
      <xs:minInclusive value="0" />
    </xs:restriction>
  </xs:simpleType> 
  <xs:simpleType name="Month">
    <xs:restriction base="xs:string">       
      <xs:enumeration value="January" />
      <xs:enumeration value="February" />
      <xs:enumeration value="March" />
      <xs:enumeration value="April" />
      <xs:enumeration value="May" />
      <xs:enumeration value="June" />
      <xs:enumeration value="July" />
      <xs:enumeration value="August" />
      <xs:enumeration value="September" />
      <xs:enumeration value="October" />
      <xs:enumeration value="November" />
      <xs:enumeration value="December" />
    </xs:restriction>
  </xs:simpleType>
</xs:schema>


thanks in advance 
my requirement is that when user click on generate xml button the account data downloads in xml format like below

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:cd="urn:cd-schema" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="DEXFileUpload" type="DEXFileUpload" />
  <xs:complexType name="DEXFileUpload">
    <xs:choice minOccurs="1" maxOccurs="5">
      <xs:element name="Clients" type="Clients" maxOccurs="1"/>
      <xs:element name="Sessions" type="Sessions"  maxOccurs="1"/>
      <xs:element name="SessionAssessments" type="SessionAssessments"  maxOccurs="1"/>
      <xs:element name="Outlets" type="Outlets"  maxOccurs="1"/>      
    </xs:choice>
  </xs:complexType>
  <xs:complexType name="Clients">
    <xs:sequence>
      <xs:element name="Client" type="Client" maxOccurs="unbounded" minOccurs="1"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Sessions">
    <xs:sequence>
      <xs:element name="Session" type="Session" maxOccurs="unbounded" minOccurs="1"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Outlets">
    <xs:sequence>
      <xs:element name="Outlet" type="Outlet" maxOccurs="unbounded" minOccurs="1"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Client">
    <xs:sequence>
      <xs:element name="ClientId" type="NonEmptyString"/>
      <xs:element name="ConsentToProvideDetails" type="xs:boolean" />
      <xs:element name="ConsentedForFutureContacts" type="xs:boolean" />
      <xs:element name="GivenName" type="NonEmptyString" nillable="true" minOccurs="0" />
      <xs:element name="FamilyName" type="NonEmptyString" nillable="true" minOccurs="0" />
      <xs:element name="IsUsingPsuedonym" type="xs:boolean" />
      <xs:element name="BirthDate" type="xs:date" />
      <xs:element name="IsBirthDateAnEstimate" type="xs:boolean" />
      <xs:element name="GenderCode" type="NonEmptyString" />
      <xs:element name="CountryOfBirthCode" type="NonEmptyString" />
      <xs:element name="LanguageSpokenAtHomeCode" type="NonEmptyString" />
      <xs:element name="AboriginalOrTorresStraitIslanderOriginCode" type="NonEmptyString" />
      <xs:element name="HasDisabilities" type="xs:boolean" />
      <xs:element name="Disabilities" nillable="true" minOccurs="0">
     
        <xs:complexType>
          <xs:sequence>
            <xs:element name="DisabilityCode" type="NonEmptyString" maxOccurs="unbounded" minOccurs="1"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="AccommodationTypeCode" type="NonEmptyString" minOccurs="0" />
      <xs:element name="DVACardStatusCode"  type="NonEmptyString"  minOccurs="0"/>
      <xs:element name="HasCarer" nillable="true" type="xs:boolean"  minOccurs="0" />
       </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Session">
    <xs:sequence>
      <xs:element name="SessionId" type="NonEmptyString" />
      <xs:element name="CaseId" type="NonEmptyString" />
      <xs:element name="TotalNumberOfUnidentifiedClients" type="MaxUnidentifiedClients"/>
      <xs:element name="FeesCharged" type="MinFeesCharged" nillable="true" minOccurs="0" />
      <xs:element name="InterpreterPresent" type="xs:boolean" nillable="true" minOccurs="0"/>
     </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Outlet"></xs:complexType>
  <xs:complexType name="ResidentialAddress">
    <xs:sequence>
      <xs:element name="AddressLine1" type="NonEmptyString" nillable="true" minOccurs="0" />
      <xs:element name="Suburb" type="NonEmptyString" />
      <xs:element name="StateCode" type="NonEmptyString" />
      <xs:element name="Postcode" type="PostCodeString" />
    </xs:sequence>
  </xs:complexType>
    <xs:simpleType name="NonEmptyString">
    <xs:restriction base="xs:string">
      <xs:minLength value="1" />
      <xs:pattern value=".*[^\s].*" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="PostCodeString">
    <xs:restriction base="xs:string">
      <xs:minLength value="4" />
      <xs:maxLength value="4" />
      <xs:pattern value="^[\d]{4}$" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="MaxUnidentifiedClients">
    <xs:restriction base="xs:integer">
      <xs:maxInclusive value="999" />
      <xs:minInclusive value="0" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="MinFeesCharged">
    <xs:restriction base="xs:decimal">
      <xs:minInclusive value="0" />
    </xs:restriction>
  </xs:simpleType> 
  <xs:simpleType name="Month">
    <xs:restriction base="xs:string">       
      <xs:enumeration value="January" />
      <xs:enumeration value="February" />
      <xs:enumeration value="March" />
      <xs:enumeration value="April" />
      <xs:enumeration value="May" />
      <xs:enumeration value="June" />
      <xs:enumeration value="July" />
      <xs:enumeration value="August" />
      <xs:enumeration value="September" />
      <xs:enumeration value="October" />
      <xs:enumeration value="November" />
      <xs:enumeration value="December" />
    </xs:restriction>
  </xs:simpleType>
</xs:schema>


thanks in advance 

 

<apex:page controller="V2Controller" tabStyle="Contact">
<apex:form >
<apex:sectionHeader subtitle="New Contact" title="Contact Edit" description="Contacts not associated with accounts are private and cannot be viewed by other users or included in reports." help="https://help.salesforce.com/articleView?err=1&id=contacts_overview.htm&siteLang=en_US&ty...>
<apex:pageBlock title="Edit Contact" >
   <apex:pageBlockSection title="Contact Information" columns="2" onkeydown="1" collapsible="false">
       <apex:outputField value="{!contact.ownerid} "/>
       <apex:inputField value="{!contact.Phone}"/>
      
    <apex:pageBlockSectionItem >
        <apex:outputlabel value="First Name"/>
            <apex:outputpanel >
            <apex:inputfield value="{!Contact.Salutation}"/>
            &nbsp;
            <apex:inputfield value="{!Contact.FirstName}"/>
        </apex:outputpanel>
   </apex:pageBlockSectionItem>
       <apex:inputField value="{!contact.homephone}" />
       <apex:inputField value="{!contact.LastName}" required="true"/>
       <apex:inputField value="{!contact.MobilePhone}"/>
       <apex:inputField value="{!contact.Accountid}"/>
        <apex:inputField value="{!contact.otherphone}"/>
        <apex:inputField value="{!contact.Title}"/>
        <apex:inputField value="{!contact.fax}"/>
        <apex:inputField value="{!contact.Department}"/>
        <apex:inputField value="{!contact.Email}"/>
        <apex:inputField value="{!contact.Birthdate}"/>
       <apex:inputField value="{!contact.Assistantname}"/>
       <apex:inputField value="{!Contact.ReportsToId}"/>
       <apex:inputField value="{!contact.AssistantPhone}"/>
       <apex:inputField value="{!contact.LeadSource}"/>
      
      
      
      
   </apex:pageBlockSection>
   <apex:pageBlockSection columns="2" title="Address Information" collapsible="false">
       <apex:inputField value="{!contact.MailingStreet}"/>
       <apex:inputField value="{!contact.otherStreet}"/>
        
       <apex:inputField value="{!contact.MailingCity}"/>
       <apex:inputField value="{!contact.otherCity}"/>
      
       <apex:inputField value="{!contact.MailingState}"/>
       <apex:inputField value="{!contact.otherState}"/>
      
       <apex:inputField value="{!contact.MailingPostalCode}"/>
       <apex:inputField value="{!contact.otherPostalCode}"/>
      
       <apex:inputField value="{!contact.MailingCountry}"/>
       <apex:inputField value="{!contact.OtherCountry}"/>
      
      
   </apex:pageBlockSection>
  
  
   <apex:pageBlockSection title=" Additional Information" collapsible="false">
      
       <apex:inputField value="{!contact.Languages__c}"/>
       <apex:inputField value="{!contact.Level__c}"/>
  
   </apex:pageBlockSection>
  
     <apex:pageBlockSection title=" Description Information" collapsible="false" >
      
       <apex:inputTextarea value="{!contact.Description}" rows="7" cols="90"/>
   </apex:pageBlockSection>
   <apex:pageBlockButtons >
       <apex:commandButton value="Save" Action="{!save}"/>  
       <apex:commandButton value="Save & New" Action="{!SaveAndNew}"/>
       <apex:commandButton value="Cancel" Action="{!cancel}" immediate="true"/> 
   </apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>

My Controller class

public class V2Controller
{
    
  public Account acc=new account();
  public Contact contact{get;set;}
  
            public V2Controller()
            {
                acc=[select id,Billingcity,BillingStreet,BillingState,BillingCountry,BillingPostalCode,ShippingStreet,
                            ShippingCity,Shippingstate,ShippingPostalCode,Shippingcountry from account where id=:apexpages.currentpage().getparameters().get('id')];
                            
                    contact=new Contact();
                    contact.Mailingcity=acc.Billingcity;
                    contact.MailingStreet=acc.BillingStreet;
                    contact.MailingState=acc.BillingState;
                    contact.MailingPostalCode = acc.BillingPostalCode;
                    contact.Mailingcountry=acc.BillingCountry;
                    
                    contact.otherStreet = acc.ShippingStreet;
                    contact.otherCity= acc.ShippingCity;
                    contact.otherstate = acc.Shippingstate ;
                    contact.otherPostalCode = acc.ShippingPostalCode;
                    contact.othercountry = acc.Shippingcountry;  
                    contact.accountid=acc.id;
            }
            
            public PageReference save()
             {
                insert contact;
                 //   ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,'Record Created Successfully.Thank you!'));
                    PageReference pg = new PageReference('/'+acc.Id);
                    pg.setRedirect(true);
                    return pg;        
                }
          
            public pagereference cancel()
            {
                    PageReference pg = new PageReference('/'+acc.Id);
                    pg.setRedirect(true);
                    return pg;
              }
              
               public Pagereference SaveAndNew()
            {
                   insert contact;
                   return null;
              }

}


// i am trying  to create visualforce page which populate the value of account address field here values are populated byt my save and new button is not working fine please suggest 
Thanks in advance
sanjay
my vf Page
vf Page



<apex:page controller="V2Controller" tabStyle="Contact">
<apex:form >
<apex:sectionHeader subtitle="New Contact" title="Contact Edit" description="Contacts not associated with accounts are private and cannot be viewed by other users or included in reports." help="https://help.salesforce.com/articleView?err=1&id=contacts_overview.htm&siteLang=en_US&ty...>
<apex:pageBlock title="Edit Contact" >
   <apex:pageBlockSection title="Contact Information" columns="2" onkeydown="1" collapsible="false">
       <apex:outputField value="{!contact.ownerid} "/>
       <apex:inputField value="{!contact.Phone}"/>
      
    <apex:pageBlockSectionItem >
        <apex:outputlabel value="First Name"/>
            <apex:outputpanel >
            <apex:inputfield value="{!Contact.Salutation}"/>
            &nbsp;
            <apex:inputfield value="{!Contact.FirstName}"/>
        </apex:outputpanel>
   </apex:pageBlockSectionItem>
       <apex:inputField value="{!contact.homephone}" />
       <apex:inputField value="{!contact.LastName}" required="true"/>
       <apex:inputField value="{!contact.MobilePhone}"/>
       <apex:inputField value="{!contact.Accountid}"/>
        <apex:inputField value="{!contact.otherphone}"/>
        <apex:inputField value="{!contact.Title}"/>
        <apex:inputField value="{!contact.fax}"/>
        <apex:inputField value="{!contact.Department}"/>
        <apex:inputField value="{!contact.Email}"/>
        <apex:inputField value="{!contact.Birthdate}"/>
       <apex:inputField value="{!contact.Assistantname}"/>
       <apex:inputField value="{!Contact.ReportsToId}"/>
       <apex:inputField value="{!contact.AssistantPhone}"/>
       <apex:inputField value="{!contact.LeadSource}"/>
      
      
      
      
   </apex:pageBlockSection>
   <apex:pageBlockSection columns="2" title="Address Information" collapsible="false">
       <apex:inputField value="{!contact.MailingStreet}"/>
       <apex:inputField value="{!contact.otherStreet}"/>
        
       <apex:inputField value="{!contact.MailingCity}"/>
       <apex:inputField value="{!contact.otherCity}"/>
      
       <apex:inputField value="{!contact.MailingState}"/>
       <apex:inputField value="{!contact.otherState}"/>
      
       <apex:inputField value="{!contact.MailingPostalCode}"/>
       <apex:inputField value="{!contact.otherPostalCode}"/>
      
       <apex:inputField value="{!contact.MailingCountry}"/>
       <apex:inputField value="{!contact.OtherCountry}"/>
      
      
   </apex:pageBlockSection>
  
  
   <apex:pageBlockSection title=" Additional Information" collapsible="false">
      
       <apex:inputField value="{!contact.Languages__c}"/>
       <apex:inputField value="{!contact.Level__c}"/>
  
   </apex:pageBlockSection>
  
     <apex:pageBlockSection title=" Description Information" collapsible="false" >
      
       <apex:inputTextarea value="{!contact.Description}" rows="7" cols="90"/>
   </apex:pageBlockSection>
   <apex:pageBlockButtons >
       <apex:commandButton value="Save" Action="{!save}"/>  
       <apex:commandButton value="Save & New" Action="{!SaveAndNew}"/>
       <apex:commandButton value="Cancel" Action="{!cancel}" immediate="true"/> 
   </apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>

My Controller class

public class V2Controller
{
    
  public Account acc=new account();
  public Contact contact{get;set;}
  
            public V2Controller()
            {
                acc=[select id,Billingcity,BillingStreet,BillingState,BillingCountry,BillingPostalCode,ShippingStreet,
                            ShippingCity,Shippingstate,ShippingPostalCode,Shippingcountry from account where id=:apexpages.currentpage().getparameters().get('id')];
                            
                    contact=new Contact();
                    contact.Mailingcity=acc.Billingcity;
                    contact.MailingStreet=acc.BillingStreet;
                    contact.MailingState=acc.BillingState;
                    contact.MailingPostalCode = acc.BillingPostalCode;
                    contact.Mailingcountry=acc.BillingCountry;
                    
                    contact.otherStreet = acc.ShippingStreet;
                    contact.otherCity= acc.ShippingCity;
                    contact.otherstate = acc.Shippingstate ;
                    contact.otherPostalCode = acc.ShippingPostalCode;
                    contact.othercountry = acc.Shippingcountry;  
                    contact.accountid=acc.id;
            }
            
            public PageReference save()
             {
                insert contact;
                 //   ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,'Record Created Successfully.Thank you!'));
                    PageReference pg = new PageReference('/'+acc.Id);
                    pg.setRedirect(true);
                    return pg;        
                }
          
            public pagereference cancel()
            {
                    PageReference pg = new PageReference('/'+acc.Id);
                    pg.setRedirect(true);
                    return pg;
              }
              
               public Pagereference SaveAndNew()
            {
                   insert contact;
                   return null;
              }

}

<apex:page controller="V2Controller" tabStyle="Contact">
<apex:form >
<apex:sectionHeader subtitle="New Contact" title="Contact Edit" description="Contacts not associated with accounts are private and cannot be viewed by other users or included in reports." help="https://help.salesforce.com/articleView?err=1&id=contacts_overview.htm&siteLang=en_US&ty...>
<apex:pageBlock title="Edit Contact" >
   <apex:pageBlockSection title="Contact Information" columns="2" onkeydown="1" collapsible="false">
       <apex:outputField value="{!contact.ownerid} "/>
       <apex:inputField value="{!contact.Phone}"/>
      
    <apex:pageBlockSectionItem >
        <apex:outputlabel value="First Name"/>
            <apex:outputpanel >
            <apex:inputfield value="{!Contact.Salutation}"/>
            &nbsp;
            <apex:inputfield value="{!Contact.FirstName}"/>
        </apex:outputpanel>
   </apex:pageBlockSectionItem>
       <apex:inputField value="{!contact.homephone}" />
       <apex:inputField value="{!contact.LastName}" required="true"/>
       <apex:inputField value="{!contact.MobilePhone}"/>
       <apex:inputField value="{!contact.Accountid}"/>
        <apex:inputField value="{!contact.otherphone}"/>
        <apex:inputField value="{!contact.Title}"/>
        <apex:inputField value="{!contact.fax}"/>
        <apex:inputField value="{!contact.Department}"/>
        <apex:inputField value="{!contact.Email}"/>
        <apex:inputField value="{!contact.Birthdate}"/>
       <apex:inputField value="{!contact.Assistantname}"/>
       <apex:inputField value="{!Contact.ReportsToId}"/>
       <apex:inputField value="{!contact.AssistantPhone}"/>
       <apex:inputField value="{!contact.LeadSource}"/>
      
      
      
      
   </apex:pageBlockSection>
   <apex:pageBlockSection columns="2" title="Address Information" collapsible="false">
       <apex:inputField value="{!contact.MailingStreet}"/>
       <apex:inputField value="{!contact.otherStreet}"/>
        
       <apex:inputField value="{!contact.MailingCity}"/>
       <apex:inputField value="{!contact.otherCity}"/>
      
       <apex:inputField value="{!contact.MailingState}"/>
       <apex:inputField value="{!contact.otherState}"/>
      
       <apex:inputField value="{!contact.MailingPostalCode}"/>
       <apex:inputField value="{!contact.otherPostalCode}"/>
      
       <apex:inputField value="{!contact.MailingCountry}"/>
       <apex:inputField value="{!contact.OtherCountry}"/>
      
      
   </apex:pageBlockSection>
  
  
   <apex:pageBlockSection title=" Additional Information" collapsible="false">
      
       <apex:inputField value="{!contact.Languages__c}"/>
       <apex:inputField value="{!contact.Level__c}"/>
  
   </apex:pageBlockSection>
  
     <apex:pageBlockSection title=" Description Information" collapsible="false" >
      
       <apex:inputTextarea value="{!contact.Description}" rows="7" cols="90"/>
   </apex:pageBlockSection>
   <apex:pageBlockButtons >
       <apex:commandButton value="Save" Action="{!save}"/>  
       <apex:commandButton value="Save & New" Action="{!SaveAndNew}"/>
       <apex:commandButton value="Cancel" Action="{!cancel}" immediate="true"/> 
   </apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>

My Controller class

public class V2Controller
{
    
  public Account acc=new account();
  public Contact contact{get;set;}
  
            public V2Controller()
            {
                acc=[select id,Billingcity,BillingStreet,BillingState,BillingCountry,BillingPostalCode,ShippingStreet,
                            ShippingCity,Shippingstate,ShippingPostalCode,Shippingcountry from account where id=:apexpages.currentpage().getparameters().get('id')];
                            
                    contact=new Contact();
                    contact.Mailingcity=acc.Billingcity;
                    contact.MailingStreet=acc.BillingStreet;
                    contact.MailingState=acc.BillingState;
                    contact.MailingPostalCode = acc.BillingPostalCode;
                    contact.Mailingcountry=acc.BillingCountry;
                    
                    contact.otherStreet = acc.ShippingStreet;
                    contact.otherCity= acc.ShippingCity;
                    contact.otherstate = acc.Shippingstate ;
                    contact.otherPostalCode = acc.ShippingPostalCode;
                    contact.othercountry = acc.Shippingcountry;  
                    contact.accountid=acc.id;
            }
            
            public PageReference save()
             {
                insert contact;
                 //   ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,'Record Created Successfully.Thank you!'));
                    PageReference pg = new PageReference('/'+acc.Id);
                    pg.setRedirect(true);
                    return pg;        
                }
          
            public pagereference cancel()
            {
                    PageReference pg = new PageReference('/'+acc.Id);
                    pg.setRedirect(true);
                    return pg;
              }
              
               public Pagereference SaveAndNew()
            {
                   insert contact;
                   return null;
              }

}


// i am trying  to create visualforce page which populate the value of account address field here values are populated byt my save and new button is not working fine please suggest 
Thanks in advance
sanjay