I tried searching for a solution before posting it here but no luck. I have a VFP with account fields and custom InputText field which is used to capture "Other" value which is concatenated(some string manipulations) to store on a field. However, i'm unable to get the edited values back to controller in order for the save to happen as i'm using inlineeditsupport. I know one way this is possible is to use a wrapper class to capture the individual values. However i'm trying to achieve without using the wrapper if possible. Please share your inputs. Thanks you!
Controller:
public with sharing class MoreFieldsUpdate_AC{
public String testValue { get; set; }
public String accId { get; set; }
public Account acc { get; set; }
public MoreFieldsUpdate_AC(ApexPages.StandardController controller){
acc = (Account)controller.getRecord();
system.debug('acc----'+acc.Id);
testValue = '';
/*accId = ApexPages.CurrentPage().getparameters().get('acId');
if(String.isNotBlank(accId))
acc = [SELECT Id, Name, Beachhead_Attributes__c, Pain_points_with_alternative__c, Benefit_Sought__c, Estimated_Budget__c, Estimated_Campaign_Timing__c, Prospect_s_target_audience_s__c, Exposure_to_TV_Ad__c,Attendees__c, Customer_Segmentation__c, Account_Status__c, Activity_Type__c, Meeting_Type__c, Primary_Lead_Source__c, Campaign__c, Discovery_Meeting__c, Pre_Meeting_Brief__c, Due_Date__c, SM_Presentation__c FROM Account WHERE Id =: accId];
else
acc = new Account();*/
}
/*public pageReference save(){
system.debug('This is not----'+acc.Benefit_Sought__c);
update acc;
return null;
}*/
public pageReference cancel(){
return null;
}
}
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="{!acc.Name}"/>
<apex:pageBlock >
<apex:pageBlockSection >
<apex:outputField value="{!acc.Beachhead_Attributes__c}" title="Beachhead Attributes">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:outputField value="{!acc.Pain_points_with_alternative__c}" title="Pain points with Alternative">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:outputField value="{!acc.Benefit_Sought__c}" title="Benefit Sought">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:outputField value="{!acc.Estimated_Budget__c}" title="Estimated Budget">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:outputField value="{!acc.Estimated_Campaign_Timing__c}" title="Estimated Campaign Timing">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:outputField value="{!acc.Prospect_s_target_audience_s__c}" title="Prospect Target Audience">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:outputField value="{!acc.Meeting_Type__c}" title="Meeting Type">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:outputField value="{!acc.Primary_Lead_Source__c}" title="Primary Lead Source">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:outputField value="{!acc.Campaign__c}" title="Campaign">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:outputField value="{!acc.Discovery_Meeting__c}" title="Discovery Meeting">
<apex:inlineEditSupport showOnEdit="saveButton, cancelButton"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
</apex:outputField>
<apex:inputText style="width: 200px;" value="{!testValue}">
<apex:outputLabel styleClass="labelCol vfLabelColTextWrap"><!--This is from Inspect Element-->
Benefit Sought (Other)
</apex:outputLabel>
</apex:inputText>
<apex:inputText style="width: 200px;" value="{!testValue}">
<apex:outputLabel styleClass="labelCol vfLabelColTextWrap"><!--This is from Inspect Element-->
Pain Points with Alternatives (Other)
</apex:outputLabel>
</apex:inputText>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>