function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
granttchartgranttchart 

The campingListItem Lightning Component doesn't contain a button or its attributes are not set correctly when clicked.

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);
    }
})

 
Thomas BolesThomas Boles
I had the same issue. First try setting the ui:button label to Packed! instead of adding it between the ui:button tags.

You may then run into a problem with your controller. I had to change my controller code to the following. 
 
({
	packItem : function(component, event, helper) {
	    var item = component.get('v.item');
        item.Packed__c = true;
        component.set('v.item', item);
        event.getSource().set('v.disabled', true);
	}
})

 
granttchartgranttchart
I replaced my controller code with yours and moved the button label from between the ui:button tags to label="" , but this trailhead challenge is still rejecting my code. 
Ramesh Peetha 4Ramesh Peetha 4
try this link

https://developer.salesforce.com/forums/?id=906F0000000kG33IAE