• Stanley Ye 18
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
Just created a form as below:
I gave the aura:id to the 'Status__c' field 
       
<lightning:recordEditForm aura:id="recordEditForm" recordId="a4p0k000001c8peAAA" objectApiName="ClientProgramEnrolment__c">      
            <lightning:inputField fieldName="Status__c" aura:id="cpe_status_test"/>
            <lightning:inputField fieldName="StatusChangeReason__c"/>
            <lightning:inputField fieldName="AccommodationSettingAfterCessation__c"/>
            <lightning:inputField fieldName="MainReasonForCessation__c"/><br/>                
</lightning:recordEditForm>   

in the js controller: 
I used the below command to retrieve the value of the 'Status__c' field:
component.find('cpe_status_test').get('v.value')

Howeve, in the console log, I see it returned 'undefined'

To investigate further, I tried below:
component.find('cpe_status_test')   -   return  '{addValueHandler: ƒ, addValueProvider: ƒ, destroy: ƒ, getGlobalId: ƒ, getLocalId: ƒ, …}'
component.find('cpe_status_test').getGlobalId()  -  return  '13:0'
component.find('cpe_status_test').getLocalId()  - return 'cpe_status_test' ;


It seems it does return the element but why get('v.value') doesn't work properly?





Thanks



 
Just created a form as below:
I gave the aura:id to the 'Status__c' field 
       
<lightning:recordEditForm aura:id="recordEditForm" recordId="a4p0k000001c8peAAA" objectApiName="ClientProgramEnrolment__c">      
            <lightning:inputField fieldName="Status__c" aura:id="cpe_status_test"/>
            <lightning:inputField fieldName="StatusChangeReason__c"/>
            <lightning:inputField fieldName="AccommodationSettingAfterCessation__c"/>
            <lightning:inputField fieldName="MainReasonForCessation__c"/><br/>                
</lightning:recordEditForm>   

in the js controller: 
I used the below command to retrieve the value of the 'Status__c' field:
component.find('cpe_status_test').get('v.value')

Howeve, in the console log, I see it returned 'undefined'

To investigate further, I tried below:
component.find('cpe_status_test')   -   return  '{addValueHandler: ƒ, addValueProvider: ƒ, destroy: ƒ, getGlobalId: ƒ, getLocalId: ƒ, …}'
component.find('cpe_status_test').getGlobalId()  -  return  '13:0'
component.find('cpe_status_test').getLocalId()  - return 'cpe_status_test' ;


It seems it does return the element but why get('v.value') doesn't work properly?





Thanks