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);
}
}
}