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:

    <!-- 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">
                <div class="slds-form-element__control">
                    <apex:inputField value="{!printSingleModalOppWrapper.opp.Opportunity_Name__c}" styleClass="slds-input slds-container--medium print-single-opp-name"/>
            <!-- more fields -->

        <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"/>
    <!-- other stuff -->


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?

  • Your button does not do anything. You need an onclick to call an action function that performs a controller action. Most likely using a param to pass the value depending on design
    – Eric
    Jun 29, 2017 at 21:14
  • i didn't post my javascript code, but the actionFunction is indeed being called as I can see the debug log message in my console
    – willard
    Jun 29, 2017 at 21:33
  • So your button has an onclick attribute or an event binding you did not show? Try using a regulate commandbutton with the slds styles and appropriately set action and rerender attributes to test functionality
    – Eric
    Jun 29, 2017 at 21:34
  • $('.deal-form').on('click', '#add-update-print-single-btn', function() { if (!dealSLDSHelper.validatePrintSingleOpp()) return; addUpdatePrintSingleOpp(); // actionFunction });
    – willard
    Jun 29, 2017 at 21:37
  • It doesn't work with commandbutton either
    – willard
    Jun 29, 2017 at 21:44


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.