Guest User

Untitled

a guest
May 21st, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. This page has an error. You might just need to refresh it.
  2. Action failed: c:campingItemForm$controller$clickCreateItem [Cannot read property 'push' of undefined]
  3. Failing descriptor: {c:campingItemForm$controller$clickCreateItem}
  4.  
  5. <aura:application extends="force:slds">
  6. <c:camping />
  7. </aura:application>
  8.  
  9. <aura:component >
  10. <aura:attribute name="items" type="Camping_Item__c[]" default="[]"/>
  11. <aura:attribute name="item" type="Camping_Item__c" default="{
  12. 'sobjectType': 'Camping_Item__c',
  13. 'campingItemName': 'campingItemNameDefault',
  14. 'Price__c': 0,
  15. 'Quantity__c': '0',
  16. 'Packed__c': false }"/>
  17. <c:campingHeader />
  18. <c:campingItemForm item="{!v.item}" items="{!items}" />
  19. <c:campingList />
  20. </aura:component>
  21.  
  22. <aura:component >
  23. <aura:attribute name="item" type="Camping_Item__c" required="true"/>
  24. <aura:attribute name="items" type="Camping_Item__c" required="true"/>
  25. <form class="slds-form--stacked">
  26. <lightning:input aura:id="campingItemForm" label="Name"
  27. name="campingItemName"
  28. value="{!v.item.Name}"
  29. required="true"/>
  30. <lightning:input aura:id="campingItemForm" label="Quantity"
  31. name="campingItemQuantity"
  32. value="{!v.item.Quantity__c}"
  33. min="1"
  34. placeholder="QQQQQ"/>
  35. <lightning:input aura:id="campingItemForm" type="number" label="Price"
  36. name="campingItemPrice"
  37. formatter="currency"
  38. step="0.01"
  39. value="{!v.item.Price__c}"/>
  40. <lightning:input aura:id="campingItemForm" type="checkbox" label="Packed"
  41. name="cmapingItemIsPacked"
  42. checked="{!v.newExpense.Reimbursed__c}"/>
  43. <lightning:button label="Create Camping Item"
  44. class="slds-m-top--medium"
  45. variant="brand"
  46. onclick="{!c.clickCreateItem}"/>
  47. </form>
  48. </aura:component>
  49.  
  50. ({
  51. clickCreateItem : function(component, event, helper) {
  52. var newItem = component.get("v.item");
  53. var items = component.get("v.items");
  54. items.push(newItem);
  55. newItem = new Camping_Item__c();
  56. component.set("v.item", item);
  57. component.set("v.items", items);
  58. }
  59. })
Add Comment
Please, Sign In to add comment