Similar to this question: Update on account is not working
I am trying to change the value of a record's field by whatever the user inputs on a visualforce page. The visualforce page is written in HTML.
Visualforce Page:
<apex:page controller="RepricingController" sidebar="false">
<script>
function checkForNAeBay(id, partslink, store) {
var a = "http://google.com";
if (id === "NA" || id === null || id === "") {
a = "http://stores.ebay.com/" + store + "?_dmd=2&_nkw=" + partslink;
} else {
a = "http://www.ebay.com/itm/" + id;
}
return a;
}
function getURL(){
return "http://www.google.com";
}
</script>
<apex:form >
<apex:actionFunction name="updateAll" action="{!updateAll}"/>
</apex:form>
<html>
<head>
<title>Repricing Table</title>
</head>
<body>
<table border="1" align="">
<apex:repeat value="{!repricing_objects}" var="repricing" id="main_repeat">
<tr>
<td>
<div class="dropdown" style="display:{!If(repricing.PDI_Repricing__Our_eBay_ID_Depot__c != null,'','none')}">
<p class="clickablefont">
{!repricing.PDI_Repricing__Our_eBay_Price_Depot__c}
</p>
<div class="dropdown-content">
<p>Shipping: {!repricing.PDI_Repricing__Our_eBay_Shipping_Depot__c}</p>
<a href="javascript:window.open(checkForNAeBay('{!repricing.PDI_Repricing__Our_eBay_ID_Depot__c}', '{!repricing.PDI_Repricing__Linked_Product__r[$Setup.PDI_Repricing__Repricing_Settings__c.PDI_Repricing__Partslink_Field__c]}', '{!$Setup.PDI_Repricing__Repricing_Settings__c.PDI_Repricing__HeadlightsDepot_Store_Label__c}'));">
View Product
</a>
<a href="javascript:window.open(getURL());" target="_blank">TEST</a>
</div>
</div>
<div class="dropdown" style="display:{!If(repricing.PDI_Repricing__Our_eBay_ID_Depot__c == null,'','none')}">
<img src="http://icons.iconarchive.com/icons/custom-icon-design/mono-general-1/512/alert-icon.png" width="20" height="20" class="clickable"/>
<div class="dropdown-content">
<p>No Item ID found!</p>
<input value="{!repricing.PDI_Repricing__Our_eBay_ID_Depot__c}"/>
<button type="button" onclick="updateAll()">
Update
</button>
<a href="javascript:window.open(checkForNAeBay('{!repricing.PDI_Repricing__Our_eBay_ID_Depot__c}', '{!repricing.PDI_Repricing__Linked_Product__r[$Setup.PDI_Repricing__Repricing_Settings__c.PDI_Repricing__Partslink_Field__c]}', '{!$Setup.PDI_Repricing__Repricing_Settings__c.PDI_Repricing__HeadlightsDepot_Store_Label__c}'));">
Find ID
</a>
</div>
</td>
</tr>
</apex:repeat>
</table>
</body>
</html>
</apex:page>
Controller:
public List<PDI_Repricing__Repricing_Info__c> repricing_objects {get;set;}
public RepricingController(){
this.repricing_objects = get_repricing_info();
}
public PageReference updateAll() {
System.debug('UPDATING: ');
for (PDI_Repricing__Repricing_Info__c o : repricing_objects){
System.debug(o.PDI_Repricing__Our_eBay_ID_Depot__c);
}
update repricing_objects;
return null;
}
After a value is placed in the input box and the 'update' button is clicked, the page refreshes and the value of the field in Pricing Info does not change. I also have page messages on the page and no errors appear in the console.
I'm only showing relevant code, so if you need more code please ask.
So any ideas why my record is not being updated? Nothing is being updated, in fact.
EDIT:
Debug:
11:57:17:037 USER_DEBUG [101]|DEBUG|UPDATING:
11:57:17:039 USER_DEBUG [103]|DEBUG|370924410604 //note this was already here, not put in by the user
11:57:17:040 USER_DEBUG [103]|DEBUG|null
11:57:17:041 USER_DEBUG [103]|DEBUG|null
11:57:17:042 USER_DEBUG [103]|DEBUG|null
11:57:17:043 USER_DEBUG [103]|DEBUG|null
11:57:17:044 USER_DEBUG [103]|DEBUG|null
<button>
to<apex:commandButton value="Update" action="{!updateAll}" />