-
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
Salesforce Flow: A Guide to Automating Business Processes
Table of Contents Introduction Identify the Processes for Automation Map Out the Process Create Your Flow with Salesforce Define Elements and Logic Test Your Salesforce…
Salesforce with DocuSign
Introduction In this era of information where everything is online so why should we wait for paper-based signing of a document when it can be…
A Guide to Salesforce ZeroBounce Integration
In today’s world, Email is like our new identity. If we want to communicate with a person whether known or unknown, email plays a crucial…