• KUMAR ANUPAM 10
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
So I've done my best to complete this challenge and received an error message that is absolutely no help.  I don't want to just copy and paste someone's correct answer, so I'm hoping someone can help me here up to and including the SFDC official helpers.

Here is my code on the CampingList Component
<aura:component >
    
    <aura:attribute name="items" type="Camping_Item__c[]"/>
    <aura:attribute name="newItem" type="Camping_Item__c" default = "{'sObjectType': 'Campaing_Item__c',
                                                                     'Quantity__c': '0', 'Price__c': '0'}"/>
    <form class="slds-form--stacked">
        <lightning:input aura:id="campingListForm" label="Camping Item"
                         name="campingItemName"
                         value="{!v.newItem.name}"/>
        <lightning:input type="number" aura:id="campingListForm" label="Quantity"
                         name="campingItemQuantity"
                         value="{!v.newItem.Quantity__c}"
                         min="1"
                         messageWhenRangeUnderflow="Enter a number greater than 0"/>
        <lightning:input type="number" aura:id="campingListForm" label="Price"
                         name="campingItemPrice"
                         value="{!v.newItem.Price__c}"
                         formatter="currency"
                         step="0.01"/>
        <lightning:input type="checkbox" aura:id="campingListForm" label="Packed?"
                         name="campingItemPacked"
                         checked="{!v.newItem.Packed__c}"/>
        <lightning:button label="Submit"
                          class="slds-m-top--medium"
                          variant="brand"
                          onclick="{!c.clickCreateItem}"/>
                        
    </form>
	
</aura:component>

I know I know, none of these have been set to required, but if that was the error I was getting, then I would update that, so please no help about making these fields required.

Here is my controller code
 
({
	clickCreateItem : function(component, event, helper) {
		var campingItems = component.get("v.items");
        var newCampingListItem = component.get("v.newItem");
        console.log("newCampingListItem before updates: " + JSON.stringify(newCampingListItem));
        newCampingListItem.name = "";
        newCampingListItem.Quantity__c = null;
        newCampingListItem.Price__c = null;
        newCampingListItem.Packed__c = false;
        console.log("newCampingListItem after updates: " + JSON.stringify(newCampingListItem));
        campingItems.push(newCampingListItem);
        component.set("v.items", campingItems);
        
        component.set("v.newItem", newCampingListItem);
	}
})

When I run the code, everything seems to work fine, but I get this error

User-added image
Since text in a picture is not searchable in search engines (yet), it says:

Challenge not yet complete... here's what's wrong:
Found the target XML.

Which isn't very helpful for me, but I'm new at this, some of you aren't, some of you aren't new at this at all.

Any help would be much appreciated!

-P