I have a list of opportunity wrappers. When I click on one, I bring up a separate div (within the same page), binding it to the opportunity wrapper that I clicked on:
public void prepPrintSingleForm() {
String uuid = Apexpages.currentPage().getParameters().get('uuid');
printSingleModalOppWrapper = getOppWrapper(uuid);
}
printSingleModalWrapper
is a member variable that is bound to some elements on my page:
<apex:form>
<!-- some stuff -->
<apex:outputPanel layout="block" id="printSingleForm" styleClass="slds-form--stacked print-single-form" >
<fieldset id="print-single-fieldset" class="slds-box slds-theme-default slds-container--large slds-hide">
<div class="slds-form-element">
<label class="slds-form-element__label" for="print-single-opp-name">
{!$ObjectType.Opportunity.fields.Opportunity_Name__c.label}
</label>
<div class="slds-form-element__control">
<apex:inputField value="{!printSingleModalOppWrapper.opp.Opportunity_Name__c}" styleClass="slds-input slds-container--medium print-single-opp-name"/>
</div>
</div>
<!-- more fields -->
</fieldset>
<div class="slds-m-top--medium slds-p-top--medium slds-grid slds-border--top">
<div class="slds-col slds-size--2-of-3"/>
<div class="slds-col slds-size--1-of-3">
<button id="add-update-print-single-btn" class="slds-button slds-button--brand" type="button">Update Print Opportunity</button>
<apex:actionFunction name="addUpdatePrintSingleOpp" action="{!addUpdatePrintSingleOpp}" rerender="printAddedComponents,errors" oncomplete="afterAddUpdatePrintSingleOpp()"/>
<div id="print-opp-errors"/>
</div>
</div>
</apex:outputPanel>
<!-- other stuff -->
</apex:form>
When I click on the #add-update-print-single-btn, it will execute the addUpdatePrintSingleOpp method within my controller. I have a debug log where I output what's in the opportunity and even when I change the name on the page, it is NOT reflected within my controller method:
public void addUpdatePrintSingleOpp() {
System.debug(logginglevel.error, 'opp: ' + printSingleModalOppWrapper.opp);
}
The weird thing about this is that if I add one more opportunity to my wrapper array, then the addUpdatePrintSingleOpp method will reflect changes I've made to the opp on the page.
So something is going on between when I first add opps to the wrapper array vs. the 2nd time. However, I can't figure out what that is. Anyone have any ideas?