+ Start a Discussion

Problem with updating edited fields when they have focus

I have a VF page to override the standard view on an object. I'm doing this so I can add in a table which shows related child records and allow some editing on those child records. However, I'm having some trouble saving the updates to these child records.


What happens is that if I use my update button after just having edited a record (the edited field still has focus), the last edit will not be saved. However, if I make the same edit again, but this time click somewhere else on the page (to cause the field to lose focus) the edit goes through successfully.


When I finally figured out this was the issue (and it took a long time), I invetigated on standard SF pages and discovered this problem was not there. I also discovered this issue was present wether I used an inputField or inlineEditSupport.


Has anyone encountered this? Know of a way around it? Perhaps I'm approaching this solution incorrectly?


Here is the page code in case it helps:

<apex:page standardController="Relationship_Request__c" extensions="RelationshipRequestViewController">
	<apex:detail subject="{!request}" relatedList="false" inlineEdit="true"/>
	<apex:form >
		<apex:pageBlock mode="maindetail" rendered="{!IF(request.RecordType.Name='Client/Prospect Transfer',TRUE,FALSE)}">
			<apex:pageBlockSection title="Request Items" columns="1">
				<apex:pageMessages />
				<apex:outputPanel id="itemTable">
					<apex:pageBlockTable value="{!items}" var="item">
						<apex:column headerValue="Client/Prospect">
							<apex:outputField value="{!item.Account__c}"/>
						<apex:column headerValue="TIN">
							<apex:outputField value="{!item.Account__r.Tax_ID_Number__c}"/>
						<apex:column headerValue="Relationship">
							<apex:outputField value="{!item.Account__r.Relationship__c}"/>
						<apex:column headerValue="Remove?">
							<apex:outputPanel id="decision">
								<apex:outputField value="{!item.Decision__c}">
									<apex:inlineEditSupport event="ondblclick"/>
						<apex:column headerValue="Comments">
							<apex:outputField value="{!item.Comments__c}">
								<apex:inlineEditSupport event="ondblclick" disabled="{!item.Removed__c}"/>
						<apex:column headerValue="Status">
							<apex:outputField value="{!item.Status__c}"/>
			<apex:pageBlockButtons location="bottom">
				<apex:actionStatus id="itemButton">
					<apex:facet name="stop">
						<apex:commandButton id="updateButton" onmouseover="document.getElementById('updateButton').focus()" action="{!updateItems}" value="Update Request Items" rerender="itemTable">
							<apex:actionSupport event="onclick" rerender="itemTable" status="itemButton"/>
					<apex:facet name="start">
						<apex:commandButton value="Updating..." disabled="true"/>
	<apex:relatedList list="ProcessSteps"/>
	<apex:relatedList list="Relationship_Request_Items__r"/>

 And the controller code:

public with sharing class RelationshipRequestViewController
    public Relationship_Request__c request {get; set;}
    private Map<Id,Relationship_Request_Item__c> itemMap;
    public List<Relationship_Request_Item__c> items {get; set;}
    public RelationshipRequestViewController (ApexPages.StandardController sc)
        request = [SELECT Id,Current_Owner__c,Approver__c,New_Owner__c,Process_Status__c,RecordType.Name
                   FROM Relationship_Request__c
                   WHERE Id = : sc.getId()];
    private void queryItems ()
    	itemMap = new Map<Id,Relationship_Request_Item__c>
    		[SELECT Id,Decision__c,Comments__c,Status__c,Account__c,Account__r.Relationship__c,
    		 FROM Relationship_Request_Item__c
    		 WHERE Relationship_Request__c = : request.Id
    		 ORDER BY Account__r.Pseudo_TIN__c,Id]
    	items = itemMap.values();
    public void updateItems ()
//    	System.Assert(false,items);
    	List<Database.SaveResult> srList = Database.update(items);
    	for (Integer i = 0; i < srList.size(); i++)
    		if (!srList[i].isSuccess())