You need to sign in to do that
Don't have an account?
uday uday chavan
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:
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>
updating values of child using fieldset in 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:
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>