I'm experiencing a strange error with Salesforce's Inline Editing in a custom visualforce page. I have a sObject with a date field called Start_Date__c, and I have inline editing set up in the VisualForce like this:
<apex:page standardController="Product_Assignment__c"
tabStyle="Product_Assignment__c"
extensions="TestInlineEditControllerExt">
<apex:form id="productForm">
<apex:pageBlock >
<apex:pageMessages />
<apex:pageBlockTable value="{!productAssignments}" var="productAssignment">
<apex:column headerClass="h1">
<apex:facet name="header">Start Date</apex:facet>
<apex:outputField value="{!productAssignment.Start_Date__c}">
<apex:inlineEditSupport changedStyleClass="dirtyField" event="ondblclick" showOnEdit="saveChanges" />
</apex:outputField>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:commandButton id="saveChanges" reRender="productForm" action="{!quicksave}" value="Save Changes" styleClass="saveChangesButton" />
</apex:form>
</apex:page>
The custom controller is as follows:
public with sharing class TestInlineEditControllerExt {
public List<Product_Assignment__c> productAssignments { get; set; }
public TestInlineEditControllerExt(ApexPages.StandardController stdController) {
stdController.addFields(new List<String> { 'Start_Date__c' });
productAssignments = new List<Product_Assignment__c> {
(Product_Assignment__c)stdController.getRecord()
};
}
}
This works well in normal use cases. If I edit the field an input a deliberately incorrect value (like 'abcdef'), and press save, I receive the expected error: Start Date: Invalid Date and Time
.
After this, if I attempt to click the revert button and save again, I receive a cryptic error message: Start Date: Value cannot exceed 0 characters
.
I've tried following this pattern on a standard detail page, but this issue only seems to happen on my custom visualforce page. I've also tried using a custom action (instead of "quicksave") on my controller, but have the same issue (error message, controller is never called). We do not have any validation rules in place for this field.
This issue appears to only happen when the page is API version 29. API version 30 produces even stranger results, where the Datepicker does not appear, inline editing only works on the field once (double clicking it again produces no result), and no message appears when trying to save an invalid date (the date just reverts). API version 31 produces similar issues, and an error "There is no record to save" if I try to save an invalid value and revert.
Does anybody know why this is happening and how I can fix this issue?
Edit: Added example controller and full VF to produce this issue
Edit 2: Added details about API version
dd/mm/yyyy
vs something else?Product_Assignment__c
is the custom object here and has aStart_Date__c
Datetime field.<apex:repeat>
or<apex:pageBlockTable>
. Unfortunately, I need to deal with a list in my code (even though this example only has a single item in the list), and I will need to use a pageBlockTable