Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. <aura:component>
  2.  
  3. <aura:attribute name="fieldApiNames" type="List" />
  4. <aura:attribute name="showSpinner" type="Boolean" default="true" />
  5.  
  6. <aura:if isTrue="{!v.showSpinner}">
  7. <lightning:spinner alternativeText="Loading..." />
  8. </aura:if>
  9.  
  10. <lightning:recordEditForm onload="{!c.handleLoad}" objectApiName="Account">
  11. <lightning:messages />
  12.  
  13. <lightning:layout multipleRows="true">
  14. <aura:iteration items="{!v.fieldApiNames}" var="api">
  15. <lightning:layoutItem aura:id="formItems" size="6">
  16. <div aura:id="top-div" />
  17. <lightning:inputField aura:id="field" fieldName="{!api}" />
  18. <div aura:id="bottom-div" />
  19. </lightning:layoutItem>
  20. </aura:iteration>
  21. </lightning:layout>
  22. </lightning:recordEditForm>
  23.  
  24. <lightning:button title="Show Field Values" onclick="{!c.handleButton}" />
  25.  
  26. </aura:component>
  27.  
  28. ({
  29. handleLoad : function(cmp, evt, helper) {
  30. cmp.set( "v.showSpinner", false );
  31. },
  32.  
  33. handleButton : function(cmp, evt, helper) {
  34. var first = cmp.get("v.fieldApiNames")[0];
  35. cmp.find("formItems").forEach( function(item) {
  36. alert( item.find("field").get("v.value") ); <== ?
  37. } );
  38. }
  39. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement