function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
fredkafredka 

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>
Nayana KNayana K
The campingList component doesn't appear to have a Quantity input field in the form using a Lightning Base 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.
Akshay_DhimanAkshay_Dhiman
Hi Fredka,
  •  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.
<!-- campingListItem Component -->

<aura:component >
	<aura:attribute name="item" type="Camping_Item__c" required="true"/>
	<ui:outputText value="{!v.item.Name}"/>   
	<ui:outputCheckbox value="{!v.item.Packed__c}"/>
	<ui:outputCurrency value="{!v.item.Price__c}"/>  	 
	<ui:outputNumber value="{!v.item.Quantity__c}"/>
    
	<ui:button label="Packed!" press="{!c.packItem}"/>
</aura:component>
Hope this may help you.
Regards,
Akshay.
 
fredkafredka
Thank you both for answering.. I think I have followed both suggestions but I'm still getting the 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.

Here is what I have for camplingListForm and campingListItem

CampingListForm
<aura:component >
    <aura:registerEvent name="addItem" type="c:addItemEvent"/>
    
    <aura:attribute name="newItem" type="Camping_Item__c"
                    default="{ 'sobjectType': 'Camping_Item__c',
                             'Name': '',
                             'Quantity__c': 0,
                             'Price__c': 0,
                             'Packed__c': false }"/>

	<form class="slds-form--stacked">
        
     <tr>
        <lightning:input name="Name" value="{!v.newItem.Name}" required="true"/>
     </tr> 

     <tr>
        <lightning:input name="Quantity" type="number"  value="{!v.newItem.Quantity__c}"  required="True"/>
     </tr>
      
     <tr>
        <lightning:input type="number" name="Price" value="{!v.newItem.Price__c}" formatter="currency" required="True"/>
     </tr>

     <tr>
         <lightning:input type="checkbox" name="Packed" value="{!v.newItem.Packed__c}" />
     </tr>

      <div class="slds-form-element">
          <ui:button label="Create Camping Item"
              class="slds-button slds-button--brand"
              press="{!c.clickCreateItem}"/>
      </div>
      
    </form>
</aura:component>

campingListItem:
<aura:component >

 <aura:attribute name="item" type="Camping_Item__c" required="true"/>
  
<lightning:input name="Name" value="{!v.item.Name}" />
        <lightning:input type="number" name="Price" value="{!v.item.Price__c}" formatter="currency"/>
        <lightning:input type="number" name="Quantity" value="{!v.item.Quantity__c}" />
        <lightning:input type="checkbox" name="Packed" value="{!v.item.Packed__c}" />
        

    
    <ui:button label="Packed!"
            press="{!c.packItem}"/>
	
</aura:component>

Thank you!!!

Fred