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
uday uday chavanuday uday chavan 

updating values of child and parent of fieldset values of vf page

this is my vf page which show to values parent and their child which i created using fieldset
i want if user edit the values of field of parent or child then it should be updated
also i created controller if user add new child it is insert properly
but i how to update the values of child and parents


this is output of my page:
User-added image


Controller:
public with sharing class AccExtension {
    Account acc;
    Public Contact Con{get;set;}
        
    public AccExtension(ApexPages.StandardController controller){
        this.acc = (Account)controller.getRecord();
        con = new Contact();
        }
    
    public List<Schema.FieldSetMember> getfieldCon(){
        list<Schema.FieldSetMember> fsFieldsList = new list<Schema.FieldSetMember>();
        fsFieldsList = SObjectType.Contact.FieldSets.Contact_Info.getFields();
        return fsFieldsList;
    }
    
    
    public PageReference save(){
        update acc;
        con.AccountId = acc.Id;
        insert con;
        return null;
    }
}

Visual force page
<apex:page standardController="Account" extensions="AccExtension" >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection title="Account information" >
              <apex:repeat value="{!$ObjectType.Account.FieldSets.AccountInfo}" var="f">
                  <apex:inputField value="{!Account[f]}"/>
                </apex:repeat>
                <apex:inlineEditSupport />
            </apex:pageBlockSection>
            <apex:pageBlockSection columns="2" title="Contact Information" >
                <apex:repeat value="{!Account.contacts}" var="c">
                    <apex:repeat value="{!$ObjectType.Contact.FieldSets.Contact_Info}" var="f">
                        <apex:inputField value="{!c[f]}"/>
                    </apex:repeat>
                    <br/>
                </apex:repeat>
             </apex:pageBlockSection>
            <apex:pageBlockSection title="Create Contact">
                <apex:repeat value="{!fieldCon}" var="c">
                        <apex:inputField value="{!Con[c]}"/>
                 </apex:repeat>   
            </apex:pageBlockSection>
            <apex:commandButton action="{!Save}" value="Save" />
        </apex:pageBlock>
    </apex:form>
</apex:page>