<aura:attribute name="Lead" type="Lead" description="潜在客户信息"/>
<lightning:recordEditForm aura:id="editForm" recordId="{!v.recordId}"  objectApiName="Lead" >
  <lightning:inputField fieldName="Company" value="{!v.Lead.Company}" />
  <lightning:inputField fieldName="LastName" value="{!v.Lead.LastName}" />
  <lightning:button variant="brand" label="Change" type="button" onclick="{!c.ChangeValue}"/>

JS Controller

ChangeValue : function(component, event, helper) {
  var lea = component.get("v.Lead");
  lea.Company = 'test';
  1. When I click the "Change" button,the view is change and company input display "test",and then I edit the company input to change value "test02".

  2. But now I second click the "Change" button,the view display company input still "test02",not display "test",anyone could tell me why and solve it.Thanks.

  • Can you elaborate a bit with what are you trying to do here? Why do you want to override the input every time? Also how is your Lead attribute populated, as of now there is not much code here to determine how are you populating the attribute as in its current form, it will not be initialized and that it will throw an error when you try to access lea.Company in the JS. – Jayant Das Apr 16 at 16:16

Your Answer

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

Browse other questions tagged or ask your own question.