1

I have VF page where I have displayed Contact information in pageBlockSection with mode="inlineEdit" as below..

<apex:page standardController="Contact" extensions="ContactDetailController" tabStyle="My_Contacts__tab" >
    <apex:form>
        <apex:pageBlock title="{!contact.name}" mode="inlineEdit" html-style="background-color: white;!important;">
            <apex:pageBlockButtons>
                <apex:commandButton action="{!saveContact}" value="Save" reRender="contact" status="loading" />
                <apex:commandButton action="{!cancelChanges}" value="Cancel" reRender="contact" status="loading" />
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Contact Information" columns="3" html-style="white-space:nowrap;!important; background-color: white;!important;" id="contact">
                <apex:outputField value="{!contact.Name}" />
                <apex:outputField value="{!contact.DoNotCall}" />
                <apex:outputField value="{!contact.AssistantName}" />
                ..............
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

I have written save method in my extension controller 'ContactDetailController' as below

public Pagereference saveContact() {
    // contact = (Contact) sController.getRecord();
    upsert sController.getRecord();    
    return null;
}
public Pagereference cancelChanges() {    
    sController.reset();
    return null;
}

The issue I am facing is , The value I edit is getting saved only if I click somewhere else in the page before clicking save button. If I edit a value and click on 'Save' button without clicking anywhere , values are not getting persisted.

This occurs even in pageBlockTable with inlineEdit. But in a Standard SFDC page I see it working properly. How to get it working in my VF page also?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.