• granttchart
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi all. I've been trying to complete the "Handle Actions With Controllers" Lightning Component trailhead for two days now. My code does exactly what the challenge requests, but when I click Check Challenge, I get the error "The campingListItem Lightning Component doesn't contain a button or its attributes are not set correctly when clicked." Is this trailhead buggy?

campingListItem.cmp: 
<aura:component >
    <aura:attribute name='item' type='Camping_Item__c' required='true' default="{'sobjectType': 'Camping_Item__c', 'Name':'Torch', 'Price__c': 10, 'Quantity__c': 1, 'Packed__c': false}"></aura:attribute>

    <ui:outputText value='{!v.item.Name}'></ui:outputText>
    <ui:outputCheckbox value="{!v.item.Packed__c}"></ui:outputCheckbox>
    <ui:outputCurrency value="{!v.item.Price__c}"></ui:outputCurrency>
    <ui:outputNumber value="{!v.item.Quantity__c}"></ui:outputNumber>
    
    <ui:button press="{!c.packItem}" disabled="false">Packed!</ui:button>
</aura:component>

campingListItemController.js:
({
    packItem: function(component, event, helper) {
        component.set("v.item.Packed__c", true);
        event.getSource().set("v.disabled", true);
    }
})

 
Hi all. I've been trying to complete the "Handle Actions With Controllers" Lightning Component trailhead for two days now. My code does exactly what the challenge requests, but when I click Check Challenge, I get the error "The campingListItem Lightning Component doesn't contain a button or its attributes are not set correctly when clicked." Is this trailhead buggy?

campingListItem.cmp: 
<aura:component >
    <aura:attribute name='item' type='Camping_Item__c' required='true' default="{'sobjectType': 'Camping_Item__c', 'Name':'Torch', 'Price__c': 10, 'Quantity__c': 1, 'Packed__c': false}"></aura:attribute>

    <ui:outputText value='{!v.item.Name}'></ui:outputText>
    <ui:outputCheckbox value="{!v.item.Packed__c}"></ui:outputCheckbox>
    <ui:outputCurrency value="{!v.item.Price__c}"></ui:outputCurrency>
    <ui:outputNumber value="{!v.item.Quantity__c}"></ui:outputNumber>
    
    <ui:button press="{!c.packItem}" disabled="false">Packed!</ui:button>
</aura:component>

campingListItemController.js:
({
    packItem: function(component, event, helper) {
        component.set("v.item.Packed__c", true);
        event.getSource().set("v.disabled", true);
    }
})