-
Stuck on Trailhead Challenge : Salesforce Lightning Client Side Controllers -"mark item as packed"
Hi everyone,
The question is this to mark item as packed, details below:
Add a button to the campingListItem component that when clicked, marks the item as packed.
- Add a button labeled Packed! that calls the packItem controller function when clicked.
- The controller action marks the item attribute as packed, updates the item value provider and disables the button.
campingListItem code :
<aura:component> <aura:attribute name=’item’ type=’Camping_Item__c’ required=’true’> <ui:outputText value=”{!v.item.Name}”/> <ui:outputNumber value=”{!v.item.Quantity__c}”/> <ui:outputCurrency value=”{!v.item.Price__c}”/> <ui:outputCheckbox value=”{!v.item.Packed__c}”/> <ui:button label=”Packed!” press=”{!c.packItem}”/> </aura:attribute> </aura:component>
where Camping_Item__c is a custom object.
My code is this:
<!–campingListController.js–> ({ packItem : function(component, event, helper) { var btn = event.getSource(); btn.set(“v.disabled”,true); component.set(“v.item.Packed__c”, “true”); } })
I tested this code and it works, checks the Packed and get the button disabled, but the challenge gives me the error:
Challenge Not yet complete... here's what's wrong:
The campingListItem JavaScript controller isn't setting the 'Packed' value correctly.Also, refer - "Refactor components and communicate with events".
What am I doing wrong? Any help?
Log In to reply.
Popular Salesforce Blogs

Creating And Maintaining the User in Salesforce
Salesforce administrator manages users by creating and editing users’ details, resetting passwords, granting/removing permissions, configuring data access levels, and much more. A user is typically…

Learn Salesforce Einstein – Chapter 5 (What is DataSet?)
What is DataSet? Data set is the collection of data to train the machine to predict. Let's understand this in the real world example. Assume…

Top Salesforce Acquisitions of All-Time-Updated 2021
Salesforce is growing at an inconceivably quick rate. The cloud computing company is on a quest to recognize gaps in their existing portfolio and fill…