0

I'm currently creating a Lightning Component for a custom object in SalesForce, for some reason the data is not binding to this input. Even when I select a date from the date picker nothing shows up on the input field. I have read/write access to the field as I see it in a previous VF page I created for this object. All other fields are binding correctly, just not the dates.

<force:recordData aura:id="applicantRecord" targetRecord="{!v.applicant}" targetFields="{!v.applicantFields}" targetError="{!v.error}" layoutType="FULL" mode="EDIT"/>

<lightning:recordEditForm objectApiName="Applicant__c">
    <div class="slds-grid">
        <lightning:input label="First Name" value="{!v.applicantFields.FirstName__c}"/>
        <lightning:input label="Last Name" value="{!v.applicantFields.LastName__c}"/>
        <lightning:input type="email" label="Email" value="{!v.applicantFields.Email__c}"/>
    </div>
    <div class="slds-grid">
        <lightning:inputField fieldName="PlacementState__c" value="{!v.applicantFields.PlacementState__c}"/>
    </div>
    <div class="slds-grid">
        <lightning:input type="checkbox" label="Ref1" checked="{!v.applicantFields.Reference1__c}" labelClass="uiLabel-top"/>
        <lightning:input type="checkbox" label="Ref2" checked="{!v.applicantFields.Reference2__c}"/>
        <lightning:input label="Bill Rate" value="{!v.applicantFields.BillRate__c}"/>
        <lightning:input label="Pay Rate" value="{!v.applicantFields.PayRate__c}"/>
    </div>
    <div class="slds-grid">
        <lightning:input type="date" label="Start Date" value="{!v.applicantFields.StartDate__c}"/>
        <lightning:input type="date" label="End Date" value="{!v.applicantFields.EndDate__c}"/>
    </div>
    <lightning:button label="Save" onclick="{!c.save}"/>
    <div>
        {!v.error}
    </div>
</lightning:recordEditForm> 

7
  • 1
    You should use lightning:inputField within a lightning:recordEditForm to create editable fields. Any specific reason why you are using lightning:input?
    – Jayant Das
    Commented Nov 7, 2018 at 15:11
  • There was no specific reason, but it still doesn't bind on lightning:inputField either.
    – JStudz
    Commented Nov 7, 2018 at 16:40
  • Do you have these fields mentioned in applicantFields? You may like to verify it there.
    – Jayant Das
    Commented Nov 7, 2018 at 16:41
  • layout mode is FULL isn't that supposed to include all Fields?
    – JStudz
    Commented Nov 7, 2018 at 16:42
  • Well, that made me want to check my Layout for Applicant. Sure enough those dates were not on it. Interested "gotcha" moment that SalesForce doesn't discuss.
    – JStudz
    Commented Nov 7, 2018 at 16:45

1 Answer 1

1

Issue was two things.

  1. As Jayant pointed out, lightning:inputField should be used rather than lightning:input.

  2. layoutType=FULL still requires the fields to be on the Page Layout of the object otherwise the data won't show when it's pulled with Lightning Data Service.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .