1

Here is my html:

<div class="slds-form-element">
    <label class="slds-form-element__label" for="digital-property-name">
        <abbr class="slds-required" title="required">*</abbr>Start/End Date
    </label>
    <div class="slds-form-element__control">
        <div class="slds-container--medium">
            <input id="dig-start-end-date" class="slds-input slds-container--medium" type="text" autocomplete="off"/>
            <apex:inputField value="{!modalOppWrapper.opp.CONSOLE_2_Schedule_Start_Date__c}" styleClass="dig-start-date slds-hide" showDatePicker="false"/>
            <apex:inputField value="{!modalOppWrapper.opp.End_Date__c}" styleClass="dig-end-date slds-hide" showDatePicker="false"/>
        </div>
    </div>
</div>

I have some javascript that takes the value from the dig-start-end-date input and plops the start and end date into the two apex:inputFields below. I know that these input fields are being populated as I have checked them in the console.

I have an actionFunction that adds the wrapper to a list object. The action function is called within javascript when clicking the add-update-digital-btn:

<button id="add-update-digital-btn" class="slds-button slds-button--brand" type="button">Add Digital Opportunity</button>
<apex:actionFunction name="addUpdateDigitalOpp" action="{!addUpdateDigitalOpp}" rerender="digitalAddedComponents,errors" oncomplete="afterAddUpdateDigitalOpp();"/>

Here is the controller method:

public void addUpdateDigitalOpp() {
    system.debug(logginglevel.error, 'opp: ' + modalOppWrapper.opp);
    digitalOppWrappers.add(modalOppWrapper);
}

The debug logs show all other fields on the opportunity filled in except for these two date fields. The date fields are null.

Things I have also tried:

  • Unhide the date fields
  • Manually input the date into those fields

I'm probably missing something stupid, but I don't know what it is.

Update: To get past the issue, I've filled in the two date fields within my controller. However, when I try to access my wrapper class via another button, the date fields are blanked out again(!). This isn't a security issue as I have checked my profile.

Here is my OppWrapper class just in case there is something in there that is causing the issue:

public class OppWrapper {
    public String uuid { 
        get { return opp.Id == null ? uuid_private : opp.Id; } 
        private set; 
    }
    public Opportunity opp { get; private set; }
    public SelectOption[] issueDateOptions { get; private set; }
    public Boolean isChanged { get; set; }
    public Decimal amount { 
        get { return opp.Amount__c; } 
        set { opp.Amount__c = value; }
    }
    public Decimal nep { 
        get { return opp.NEP__c; } 
        set { opp.NEP__c = value; }
    }

    private String uuid_private;

    public OppWrapper(Opportunity opportunity) {
        opp = opportunity;
    }

    public void generateUUID() {
        if (String.isBlank(this.uuid)) {
            Blob b = Crypto.GenerateAESKey(128);
            String h = EncodingUtil.ConvertTohex(b);
            uuid_private = h.SubString(0,8)+ '-' + h.SubString(8,12) + '-' + h.SubString(12,16) + '-' + h.SubString(16,20) + '-' + h.substring(20);
        }
    }
}
  • is your section with input fields (given div) inside component (f.e. form, outputPanel etc ) with id digitalAddedComponents ? – kurunve Jun 21 '17 at 21:11
  • it is not, no. should it be? – willard Jun 21 '17 at 21:12
  • I guess so. Idea is that only rerendered part is submitted to server in case of partial form submit – kurunve Jun 21 '17 at 21:14
  • But all of my other fields within that section are sent back to the controller. it is specifically the date fields. Also the rerender controls the portion of the page that is refreshed after the actionFunction. It shouldn't control what gets passed back to the controller. – willard Jun 21 '17 at 21:18
  • I guess I misunderstand your question at first. You are correct in your last comment, it should work. Do you have action:region used in your visualforce? – kurunve Jun 21 '17 at 21:23
2

ugh - i figured it out. There was another apex:inputField that was bound to the same variable (used in different parts of the page flow). I've separated these out into separate wrappers and all is well.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.