You need to sign in to do that
Don't have an account?

Problem finishing Lightning Component Basics
I am trying to complete the last segment of this trail. I'm getting the following error: Challenge Not yet complete... here's what's wrong:
The campingList component doesn't appear to have a Quantity input field in the form using a Lightning Base component.
On my camping list component I refer to two other components. c:campingListForm and c: campingListItem I do have the Quanity field on each of those components. I assume it is the campingListItem that I am having issue with but not sure why. This code was not a problem for the all of the other segments of the trail. Any help would be greatly appreciated. Here is the code for my camplinglistitem component:
<aura:component >
<aura:attribute name="item" type="Camping_Item__c" />
<p>Name:
<ui:outputText value="{!v.item.Name}"/>
</p>
<p>Price:
<ui:outputCurrency value="{!v.item.Price__c}"/>
</p>
<p>Quantity:
<ui:outputNumber value="{!v.item.Quantity__c}"/>
</p>
<p>Packed:
<ui:outputCheckbox value="{!v.item.Packed__c}"/>
</p>
<ui:button label="Packed!"
press="{!c.packItem}"/>
</aura:component>
The campingList component doesn't appear to have a Quantity input field in the form using a Lightning Base component.
On my camping list component I refer to two other components. c:campingListForm and c: campingListItem I do have the Quanity field on each of those components. I assume it is the campingListItem that I am having issue with but not sure why. This code was not a problem for the all of the other segments of the trail. Any help would be greatly appreciated. Here is the code for my camplinglistitem component:
<aura:component >
<aura:attribute name="item" type="Camping_Item__c" />
<p>Name:
<ui:outputText value="{!v.item.Name}"/>
</p>
<p>Price:
<ui:outputCurrency value="{!v.item.Price__c}"/>
</p>
<p>Quantity:
<ui:outputNumber value="{!v.item.Quantity__c}"/>
</p>
<p>Packed:
<ui:outputCheckbox value="{!v.item.Packed__c}"/>
</p>
<ui:button label="Packed!"
press="{!c.packItem}"/>
</aura:component>
Lightning Base componets are the ones haveing "lightning" namespace not "ui" namespace. Like lightning:card, lightning:input.
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_lightning_formattedNumber.htm
I think you have to use lightning:formattedNumber to display a number field.
- For your ‘campingListItem component', you have to provide ‘required property which has to be ‘true’ inside aura: attribute in order to pass the challenge’
- ‘Required’ Property: It determines if the attribute is required. The default is ‘false’. And rest of the code has no problem.
Hope this may help you.Regards,
Akshay.
The campingList component doesn't appear to have a Quantity input field in the form using a Lightning Base component.
Here is what I have for camplingListForm and campingListItem
CampingListForm
campingListItem:
Thank you!!!
Fred