4

how can one bind onchange event handlers to the fields of the lightning:recordform component?

component.cmp

   <aura:attribute name="fieldsArray" type="String[]"
   default="['Subject','Description']" />

    <lightning:recordForm aura:id="recordForm"
           objectApiName="Case"
           fields="{!v.fieldsArray}"               
           layout="Full"
           mode="Edit"
           onsubmit="{!v.submit}"
           />

if i were to use lightning:recordEditForm component, i would simply add it in my field component as follows:

<lightning:inputField fieldName="Subject" onchange="{!c.itemsChange}"/>

the lack of documentation on this component doesnt make this easy.

  • What happens when you put a change event handler on v.fieldsArray and change a value in an input? Any change event handled? – tsalb Jun 20 '18 at 3:48
  • nothing , since the attribute is for the fieldset itself, which doesnt change =( – glls Jun 20 '18 at 3:51
  • There's a hidden fields attribute on recordEditForm that you can inspect to retrieve field values. Since this component supposedly builds on top of recordEditForm I had thought maybe you can inspect it somehow. – tsalb Jun 20 '18 at 4:47
  • Actually, if you component.find("recordForm").get("v.fields") does it return more than your original list of strings? I'm out of ideas after that. – tsalb Jun 20 '18 at 4:49
  • 1
    the component is not mature enough nor is it well documented, so i went back to using lightning:recordeditform component. I will wait some time before attemtping anything with it – glls Aug 8 '18 at 21:14

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.