+ Start a Discussion
King KooKing Koo 

InlineEditSupport not showing Save when there are validation errors...?

Hi there

Have a very simple sample here
 
<apex:page standardController="Contact">
    <apex:form >
        <apex:pageMessages/>
        <apex:pageBlock mode="inlineEdit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!edit}" id="editButton" value="Edit" style="display: none;"/>
                <apex:commandButton action="{!save}" id="saveButton" value="Save" style="display: none;"/>
                <apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel" style="display: none;"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection >
                <apex:outputField value="{!contact.date__c}">
                    <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" 
                        hideOnEdit="editButton" event="ondblclick" 
                        changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
                </apex:outputField>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>


As you can see there is a Date field which supports inline edit.

When you double click the field, the Save and Cancel buttons show.  Now if I enter some bad data into the Date field, such as "abc", and click Save, it'll fail the validation rule.

It's obvious because the error displays in the <apex:pageMessages/> tag, but I cannot find a way to show the "Save" and "Cancel" buttons anymore.

Anyone knows what I'm missing here?
Thanks
King
SonamSonam (Salesforce Developers) 
Am able to reproduce this on my test ORG and checked with the team inhouse..seems like this has been reported as an issue with the date field on VF with inline editing enabled. 

Try the following workaround(checked this on my test ORG):

<apex:page standardController="contact"> 
<apex:form id="productForm"> 
<apex:pageBlock mode="inlineEdit" > 
<apex:pageBlockButtons > 
<apex:commandButton id="saveChanges" reRender="productForm" action="{!quicksave}" value="Save Changes" styleClass="saveChangesButton" /> 
</apex:pageBlockButtons> 
<apex:pageBlockSection >
<apex:outputField value="{!contact.Check_date__c}"> 

<apex:inlineEditSupport showOnEdit="saveButton, cancelButton" 
hideOnEdit="editButton" event="onclick" 
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> 
</apex:outputField> 
</apex:pageBlockSection>
</apex:pageBlock> 
</apex:form> 
</apex:page>
King KooKing Koo
Hi Sonam

Thanks for your reply.

But the focus is not about the date field, it's about Save and Cancel don't show anymore.

I can replace that date field with a numeric field and enter abc and Save.  Same situation - error message displays but Save and Cancel don't.

Thanks
King
dhuntdhunt
I used a workaround with jquery.  This runs when the page initializes.
 
if($j("[id$=':pagemessages']").html()!="")
{
	$j("[id$='btnSave']").attr('style','');
	$j("[id$='btnCancel']").attr('style','');
}


<apex:commandButton id="btnSave" value="Save" style="display:none"  action="{!SaveButton}" ></apex:commandButton>
			
<apex:commandButton id="btnCancel" value="Cancel" style="display:none" action="{!CancelButton}" immediate="true"></apex:commandButton>

<apex:pageMessages id="pagemessages" ></apex:pageMessages>