You need to sign in to do that
Don't have an account?
KMN
how to make editable Related record in vf page
HI,
I have Create a page like account form and add some related contacts
and i want make that contacts editable.
Can someone help i am practicing on it.
code...on standardcontroller
I have Create a page like account form and add some related contacts
and i want make that contacts editable.
Can someone help i am practicing on it.
code...on standardcontroller
<apex:page standardController="Account"> <style> .s1{Background-Color: LightBlue;} .s2{Background-Color: Pink;} </style> <apex:form > <apex:sectionHeader title="Account" subtitle="Account Form"/> <apex:pageBlock title="Account Form" > <apex:pageBlockSection title="Account Information" columns="2"> <apex:inputField value="{!Account.Owner.Name}" styleClass="s1"/> <apex:inputField value="{!Account.Rating}" style="BackGround-Color:Pink; color: blue;"/> <apex:inputField value="{!Account.Name}" styleClass="s1"/> <apex:inputField value="{!Account.Phone}" styleClass="s2"/> <apex:inputField value="{!Account.ParentId}" styleClass="s1"/> <apex:inputField value="{!Account.Fax}" styleClass="s2"/> <apex:inputField value="{!Account.AnnualRevenue}" styleClass="s1"/> <apex:inputField value="{!Account.NumberOfEmployees}" styleClass="s2"/> <apex:inputField value="{!Account.Ownership}" styleClass="s1"/> <apex:inputField value="{!Account.website}" styleClass="s2"/> </apex:pageBlockSection> <apex:pageBlockSection title="Additional Information" columns="2"> <apex:inputField value="{!Account.Site}" styleClass="s1"/> <apex:inputField value="{!Account.AccountNumber}" styleClass="s2"/> <apex:inputField value="{!Account.Industry}" styleClass="s2"/> <apex:inputField value="{!Account.Type}" styleClass="s1"/> </apex:pageBlockSection> <apex:pageBlockSection title="Address Information" columns="2"> <apex:inputField value="{!Account.BillingStreet}" styleClass="s1"/> <apex:inputField value="{!Account.ShippingStreet}" styleClass="s2"/> <apex:inputField value="{!Account.BillingState}" styleClass="s1"/> <apex:inputField value="{!Account.ShippingState}" styleClass="s2"/> <apex:inputField value="{!Account.BillingCity}" styleClass="s1"/> <apex:inputField value="{!Account.ShippingCity}" styleClass="s2"/> <apex:inputField value="{!Account.BillingPostalCode}" styleClass="s1"/> <apex:inputField value="{!Account.ShippingPostalCode}" styleClass="s2"/> <apex:inputField value="{!Account.BillingCountry}" styleClass="s1"/> <apex:inputField value="{!Account.ShippingCountry}" styleClass="s2"/> </apex:pageBlockSection> <apex:pageBlockSection title="Description" columns="2"> <apex:inputField value="{!Account.Description}" styleClass="s1"/> </apex:pageBlockSection> <apex:pageBlock title="Related Contacts"> <apex:pageBlockTable value="{!Account.contacts}" var="con"> <apex:column value="{!con.firstName}"/> <apex:column value="{!con.LastName}"/> <apex:column value="{!con.Phone}"/> <apex:column value="{!con.AccountId}"/> </apex:pageBlockTable> </apex:pageBlock> <apex:pageBlockButtons location="Bottom"> <apex:commandButton action="{!Save}" value="Save"/> <apex:commandButton action="{!Cancel}" value="Cancel"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>
You have to extension contoller to update the related contacts:
Please try the below codes:
Visualforce Page:
Apex Class:
Thanks,
Maharajan.C
All Answers
You have to extension contoller to update the related contacts:
Please try the below codes:
Visualforce Page:
Apex Class:
Thanks,
Maharajan.C
You can use custom controller to perform on this requirement
you are going to have to create an Apex Controller on the backend and call it at Save button click.
you can get reference from this link:
Click On --> link (https://developer.salesforce.com/forums/?id=906F0000000BXFkIAO)
If you find your Solution then mark this as the best answer.
Thank you!
Regards,
Suraj Tripathi
Your code good working fine but it take me to the UI page.
how can i do that whole process should be on vf page only
after click save button should not go on UI page
Thanks,
Maharajan.C
For your help and Time..