• Patrick Maxwell 2
  • NEWBIE
  • 60 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    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

Few questions:

I have a class with 'State' and 'Number'. The combination should be unique, and should be the Name field for the table. I'm hitting some road blocks that I suspect are built-in limitations of SF:

 

  1. Is there a way to make the Name Field a formula? If there is, I haven't found it.
  2. Is there a way to require the Name Field to be unique?
  3. Is there a way to make any Formula Field unique?

One work-around would be using auto-increment for the Name, but this will show up on Lookup Fields, and that's a deal killer. Any suggestions?

Another would be a Trigger that sets the Name before the district is saved and checks for uniqueness. This seems a lot of work for what should be something easy, but I could do it.

 

Is there an elegant approach. What have people tried?

I have a text formula to which I would like to add a carriage return/line break.  I tried concatenating chr(13) and chr(10), but the validation didn't like it.  Is this possible?