-
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
Introducing Screen Flow in Salesforce
In this Blog, we will learn about Screen Flows. As we all know, flow is an automation tool provided by Salesforce which can be used…
Top 8 Things to Consider While Selecting Salesforce CPQ Consulting Partner
Salesforce CRM has been a revelation when it comes to elevating the productivity of the company. Starting from managing the Sales Funnel to getting the…
Transparency to Manufacturers with Salesforce Manufacturing Cloud
Salesforce, a CRM software company has announced Manufacturing Cloud that is a new industry-oriented product for manufacturers. Manufacturing Cloud is a part of Salesforce’s Customer 360 Platform for…