-
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
Need of Salesforce Services for Financial Advisors
Salesforce has become one of the topmost CRM for every organization. Every organization ranging from non-profit, educational, finance advisories, banks, retail and other is using…
Learn About Free Pardot Org | Salesforce Developer Edition
There are two types of free Pardot org is available:- Pardot Demo Org:- This org is Similar to our internal Demo environments which includes some…
Pagination of an Infinite List of Records in Salesforce: Challenges and Resolution Methods
Author: Ievgen Kyselov, Salesforce developer at NIX This pagination approach is not new or uncommon, but it's rarely discussed in detail. What I am showcasing…