+ Start a Discussion
JCoppedgeJCoppedge 

Saving data to objects - need custom controller/extension?

Order_Offers custom object related to opportunity (M/D). I can display the Order Offers without any issue.

When I use an input field it will display the correct text, but the save function doesn't save the data into the related record. Is a controller extension required for saving multiple records at a time? If so, can anyone point me to an code example of this nature?

PS. Where is the insert code button, or what is the HTML code to do so?

Thanks,
John

apex:page standardController="opportunity" sidebar="false" showHeader="false" renderAs="HTML">
<br>.TextAreaLarge {width:400px; height:250px;}<br>

apex:pageblock title="Order Information">
apex:outputtext >
Order Number: {!Opportunity.Order_Number__c}

Order Placer: {!Opportunity.Order_Placer__c}



Account: {!Opportunity.Account.Name}

/apex:outputtext>
/apex:pageblock>

apex:pageblock title="Circulation & Cost">
apex:outputText value="Order Total Cost: ${!Opportunity.Amount}"/>

apex:outputText value="Total Order Circulation: {!Opportunity.Circulation__c}" style=""/>
/apex:pageblock>

apex:form >
apex:pageblock >
apex:pageblocktable value="{!Opportunity.Order_Offers__r}" var="offer">
apex:column headervalue="Disclaimer 1">
apex:inputfield value="{!offer.Offer_Disclaimer_1__c}" styleClass="TextAreaLarge"/>
/apex:column>
apex:column headervalue="Disclaimer 2">
apex:inputtextarea value="{!offer.Offer_Disclaimer_2__c}"/>
/apex:column>
/apex:pageblocktable>
apex:commandButton value="Save" action="{!save}"/>
apex:commandbutton value="Cancel" action="{!cancel}"/>
/apex:pageblock>
/apex:form>

apex:pageblock title="Stores">
apex:pageblocktable value="{!Opportunity.Store_Entries__r}" var="store">
apex:column value="{!store.Store__c}"/>
apex:column value="{!store.Circulation__c}"/>
apex:column value="{!store.Directionals__c}"/>
/apex:pageblocktable>
/apex:pageblock>
/apex:page>
KtobenerKtobener

I would really like to know the answer to this question as well! I've made a very similar page with Opportunities and related Opportunity Products in tables, and I'd like to be able to perform inline editing/saving on the opportunity products, but as it stands I can only save inline edits to the opportunity.

 

I've been reading alot about custom controller extensions and save methods, but I just cannot seem to make it work either. Anyone lend a helping hand? :)

sfdcfoxsfdcfox
The StandardSetController is used to display/edit/save/etc multiple records at once. If that fails, you could also create a custom save button and have that call update() on the entire list at once. Regardless, you will definitely need to use an extension or a component that uses a StandardSetController in order to edit multiple records at once.