You need to sign in to do that
Don't have an account?
SATHISH REDDY.
Unable to save one field at a time using inlineeditsupport on Visualforce page
Hi,
I'm unable to save one field at a time using inlone edit on visualforce page.
VFP:
When i try to inlineedit a single field at a time & save, the save is unsuccessful. While it works fine when all fields are edited at once and saved at the end. Not sure what is missing here, please shed some light on the missing piece here. Thanks in advance!
I'm unable to save one field at a time using inlone edit on visualforce page.
VFP:
<apex:page standardController="Account" extensions="MoreFieldsUpdate_AC" sidebar="false" showHeader="false" lightningStylesheets="true"> <style> .multiSelectPicklistRow select { max-width: 300px; } </style> <apex:form id="formId"> <apex:pagemessages escape="false"/> <apex:slds /> <!--<div style="text-align: center"><br/><br/> <apex:commandButton action="{!save}" id="saveButton" value="Save" status="status" rerender="formId" rendered="true" styleClass="buttonStyle" style="background:LightBlue;width:150px;"/> <apex:commandButton action="{!cancel}" id="cancelButton" value="Cancel" rendered="true" styleClass="buttonStyle" style="background:LightBlue;width:150px;"/> </div>--> <apex:sectionHeader subtitle="{!Account.Name}"/> <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton action="{!edit}" id="editButton" value="Edit" rendered="true" styleClass="buttonStyle" style="background:LightBlue;width:150px;"/> <apex:commandButton action="{!save}" id="saveButton" value="Save" status="status" rerender="formId" rendered="true" styleClass="buttonStyle" style="background:LightBlue;width:150px;"/> <apex:commandButton action="{!cancel}" id="cancelButton" value="Cancel" rendered="true" styleClass="buttonStyle" style="background:LightBlue;width:150px;"/> </apex:pageBlockButtons> <apex:pageBlockSection title="General Info"> <apex:outputField value="{!Account.Beachhead_Attributes__c}"> <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> </apex:outputField> <apex:outputField value="{!Account.Primary_Lead_Source__c}"> <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> </apex:outputField> <apex:outputField value="{!Account.Estimated_Budget__c}"> <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> </apex:outputField> <apex:outputField value="{!Account.Campaign__c}"> <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> </apex:outputField> <apex:outputField value="{!Account.Estimated_Campaign_Timing__c}"> <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> </apex:outputField> <apex:outputField value="{!Account.Prospect_s_target_audience_s__c}"> <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> </apex:outputField> </apex:pageBlockSection> <apex:pageBlockSection title="Additional Info"> <apex:outputField value="{!Account.Benefit_Sought__c}"> <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> </apex:outputField> <apex:outputField value="{!Account.Pain_points_with_alternative__c}"> <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> </apex:outputField> <apex:inputText style="width: 200px;" value="{!otherBenefitSought}"> <apex:outputLabel styleClass="labelCol vfLabelColTextWrap"><!--This is from Inspect Element--> Benefit Sought (Other) </apex:outputLabel> </apex:inputText> <apex:inputText style="width: 200px;" value="{!otherPainPointsWithAlternatives}"> <apex:outputLabel styleClass="labelCol vfLabelColTextWrap"><!--This is from Inspect Element--> Pain Points with Alternatives (Other) </apex:outputLabel> </apex:inputText> <apex:outputField value="{!Account.Additional_information__c}"> <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/> </apex:outputField> </apex:pageblockSection> </apex:pageBlock> </apex:form> </apex:page>Controller:
public with sharing class MoreFieldsUpdate_AC{ public String otherBenefitSought { get; set; } public String otherPainPointsWithAlternatives { get; set; } public Account acc { get; set; } public MoreFieldsUpdate_AC(ApexPages.StandardController controller){ acc = (Account)controller.getRecord(); } public void save(){ system.debug('Benefit Sought----'+acc.Benefit_Sought__c); update acc; } public pageReference cancel(){ PageReference reloadOnCancel = new PageReference('/apex/MoreFieldsUpdate_VF?Id='+acc.Id+'&core.apexpages.devmode.url=1'); reloadOnCancel.setRedirect(true); return reloadOnCancel; } }Pic:
When i try to inlineedit a single field at a time & save, the save is unsuccessful. While it works fine when all fields are edited at once and saved at the end. Not sure what is missing here, please shed some light on the missing piece here. Thanks in advance!