You need to sign in to do that
Don't have an account?

Updating Values in a Table
I have a custom Quote object and this has a line item related list linked to it with the quote products. I have created a visualforce page displaying a table of the products linked to the quote. On this page i want to be able to edit the values, e.g. price of the product. I have then put a save button on the visualforce page. However when you click save it goes back to the quotes page but the values on the line items havnt been updated.
<apex:page standardController="Quotes__c" > <apex:form > <apex:pageBlock mode="edit"> <apex:pageBlockSection Title="Update Products Pricing & Quantities"> <table border="0" width="100%" id="table4"> <tr> <td bgcolor="#C0C0C0"><font face="Arial">Product</font></td> <td bgcolor="#C0C0C0"><font face="Arial">Price</font></td> <td bgcolor="#C0C0C0"><font face="Arial">Quantity</font></td> </tr> <apex:repeat value="{!Quotes__c.Line_Items__r}" var="line"> <tr> <td><apex:InputField value="{!line.Product__r.Name}"/></td> <td><apex:InputField value="{!line.Unit_Price__c}"/></td> <td><apex:InputField value="{!line.Units_Sold__c}"/></td> </tr> </apex:repeat> </table> </apex:pageBlockSection> <apex:commandButton action="{!save}" value="Update"/> </apex:pageBlock> </apex:form> </apex:page>
This is the code for my visualforce page.
Can someone let me know why the values are not being saved and updated on the quote page.
Many thanks,
Matt
Hi ,
it because the standard save functionality is only working for standard object that you are defined (Quotes__c).
I believe in your code you were trying to accessing another object ( Line_Items__r ).
Please correct me if Im wrong.
my suggestion is create variable temporary in apex class to accessing the Line_Items__r ( eg. varLineItem ), pass it to visualforce page then create new functionality of save button in the extensions.
it should be working.
cheers!
slie
Hi,
Thanks for the help it seems like this does seem to be the problem.
Im pretty new to apex coding, do you know of any examples i could use to for the variables and save function?
Matt
// constructor
Account temp = [Select id, name from Account where name := 'Test' limit 1];
List<Contact> tempC = [ Select name, address, phone from Contact where AccountID = : temp ];
// new function of save
public void saveNew()
{
update tempC;
}