-
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
How TLS impacts Salesforce?
When we are working in a pool of networks i.e INTERNET, we need a protocol. Yes, you might have heard this term in your High…
Jira - Salesforce Integration: Why You Should Use a No-code Integration Platform?
Workflow automation, enhanced performance, and high availability are three of the most vital components of every successful modern-day enterprise. The ability to track valuable performance…
Interaction Studio: Salesforce's Next-Level Marketing App
In this day and age, having a next-level marketing tool is crucial if you want to stay ahead of the competition. To do that, you…