0

I've got this 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.

While trying to complete this trailhead. My form looks like this:

    <form class="slsd-form--stacked">
            <lightning:input aura:id="campingform" label="Item Name"
                             name="itemname"
                             value="{!v.newItem.Name}"
                             required="true"/>
            <lightning:input aura:id="campingform" label="Quantity"
                             type="number"
                             name="itemquantity"
                             value="{!v.newItem.Quantity__c}"
                             required="true"/>
            <lightning:input aura:id="campingform" label="Price"
                             name="itemprice"
                             formatter="currency"
                             value="{!v.newItem.Price__c}"
                             required="true"/>
            <lightning:button label="Add Item"
                              class="slsd-m-top--medium"
                              variant="brand"
                              onclick="{!c.addCampingItem}"/>
        </form>

Any idea what's wrong there?

  • One thing that I missed doing my first trails is, that in the box where you confirm it, there is another Task, than the one described above. Might that be your problem? – Basti Oct 16 '17 at 10:47
2

Try this one, I hope it will solve your problem

    <lightning:input aura:id="campingform" label="Camping Name"
                                     name="campingname"
                                     value="{!v.newItem.Name}"
                                     required="true"/> 
                    <lightning:input type="number" aura:id="campingform" label="Quantity"
                                     name="campingQuantity"
                                     min="1"                                    
                                     step="1"
                                     value="{!v.newItem.Quantity__c}"
                                     messageWhenRangeUnderflow="Enter an Quantity that's at least 1."/>
                      <lightning:input type="number" aura:id="campingform" label="Price"
                                     name="campingPrice"
                                     min="0.1"
                                     formatter="currency"
                                     step="0.1"
                                     value="{!v.newItem.Price__c}"
                                     messageWhenRangeUnderflow="Enter an Price that's at least 0.1."/>
                    <lightning:input type="checkbox" aura:id="campingform" label="Packed ?"  
                                     name="campingPacked"
                                     checked="{!v.newItem.Packed__c}"/>
                    <lightning:button label="Create Camping" 
                                      class="slds-m-top--medium"
                                      variant="brand"
                                      onclick="{!c.clickCreateItem}"/>
  • Yeah. I found the issue :-D it was min="1" on lightning:input for Quantity. I didn't noticed that there is requirement have at least one item. – jakub Oct 16 '17 at 11:12
  • 1
    @Saurabh Sood, please avoid posting code dumps and asking people if it helps, instead, provide an explanation along the code sample for a better understanding. Thanks – glls Oct 16 '17 at 12:45
  • This unit got me hanging for a while. At first- Seems like it’s not possible to pass it. But after getting some more experience I’ve decided to tackle this one once again. Don’t know if something change on Salesforce notifications side but after rebuild the whole bundle and follow the unit carefully again I finally manage to get this badge ! Hooray! – sfdx bomb Jun 10 '18 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.