0

learning some lightning, and am having this issue.

<aura:attribute name="cObj" access="global" type="Case" default="{'sObjectType':'Case'}" />
<div class="slds-form-element slds-hint-parent slds-m-left--large slds-m-right--large  slds-m-top--large slds-form-element__control" style ="font-weight:bold; color:rgb(84, 105, 141);font-size: .75rem;"> 
    <ui:inputDate label="Due Date"
                  aura:id="Due_Date__c" 
                  value="{!v.cobj.Due_Date__c}" 
                  displayDatePicker="true"
                  class="slds-input" />
</div>

so I see the field on the page, but when I click it and select the date, then click a different part of the page, the field goes blank. no issue using ui:inputText in the same format?

I doubled checked to see if Due_Date__c is a Date field too. Wonder if there is something I'm missing?

1 Answer 1

1

With Locker Service you need to instantiate each field that you are going to use in your component which means the due_date__c needs to be set to '' in your attribute default declaration.

<aura:attribute name="cObj" access="global" type="Case" default="{'sObjectType':'Case','Due_Date__c': ''}"/>

Every field of the sobject that you want to use in your component needs to be instantiated like above.

Also Your attribute name is 'cObj' you have used 'cobj' in the ui:input date. There is a typo in the attribute name

5
  • hmmm I tried doing that and the due_date field behavior didn't change.
    – J. Zhang
    Jun 12, 2017 at 17:21
  • I think if you can elaborate or provide more clarity on 'click a different part of the page'.It would help if you can post code for the complete page.
    – RedDevil
    Jun 12, 2017 at 17:27
  • As in click outside of the input box. will update my code, but its nothing fancy. just those input fields in a div.
    – J. Zhang
    Jun 12, 2017 at 17:55
  • Edited the answer. check the last line i think there is a typo in the attribute name you have used. 'cObj' should be used you have used 'cobj'
    – RedDevil
    Jun 13, 2017 at 2:16
  • ah. that worked. ty!
    – J. Zhang
    Jun 13, 2017 at 13:36

You must log in to answer this question.

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