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
sai sekhar 1sai sekhar 1 

Superbadge Lightning Component Framework Specialist challenge 5

Hi,

I am getting the following error eventhough I defined selected attribute .

User-added image

please check my code

boatserachresults:
<aura:component controller="BoatSearchResults">
    
    <aura:handler name="init" action="{!c.doSearch}" value="{!this}"/>
    <aura:attribute name="boats" type="Boat__c[]" />
    <aura:attribute name="boatTypeId" type="id" />
    <aura:attribute name="selectedBoatId" type="id" />

    <aura:method name="search" description="accepts boatTypeId
            and executes search that refreshes the boats attribute" action="{!c.search}" >
        <aura:attribute name="boatTypeId" type="Id"/>
    </aura:method>
    
    <aura:handler name="BoatSelect"
                  event="c:BoatSelect"
                  action="{!c.onBoatSelect}"
                  phase="capture"/>
    
     <aura:if isTrue="{!not(empty(v.boats))}">
        <lightning:layout multipleRows="true" horizontalAlign="center">
                <aura:iteration items="{!v.boats}" var="boatVar">
                    <lightning:layoutItem flexibility="grow"  class="slds-m-right_small" >   
                    <c:BoatTile boat="{!boatVar}" 
                                selected="{!v.selectedBoatId==boatVar.Id ? true : false }"/>
                    </lightning:layoutItem>
                </aura:iteration>
        </lightning:layout>
         <aura:set attribute="else">
            <div class="slds-align_absolute-center">No boats found</div>
        </aura:set>
    </aura:if>
</aura:component>

Boattilecmp:
 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes" access="global" >
	<aura:attribute name="boat" type="Boat__c" />
    <aura:attribute name="selected" type="boolean" default="false"/>

    <aura:registerEvent name="BoatSelect" type="c:BoatSelect"/>
    
    <lightning:button name="{!v.boat.Id}" class="{!v.selected? 'tile selected' : 'tile'}"
                       onclick="{!c.onBoatClick}" >
        <div style="{! 'background-image:url(\'' + v.boat.Picture__c + '\'); '}" class="innertile">
          <div class="lower-third">
           <h1 class="slds-truncate">{!v.boat.Contact__r.Name}</h1>
          </div>
        </div>
    </lightning:button>
</aura:component>

 
sonal gupta 36sonal gupta 36
Hi
I am getting error "Failed to save BoatSearchForm.cmp: Invalid definition for null:BoatSearchForm: null: Source" for BoatSearchForm.comp
Any help?
Please see code below

<aura:component controller="BoatSearchForm" implements="force:appHostable,flexipage:availableForAllPageTypes"  access="global" >
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="searchOptions" type='String[]' default='All'/>
    <aura:attribute name='searchOptionToIdMap' type='Map' default="{All:''}" />
    <aura:attribute name='showNewButton' type='Boolean' default='false'/>

    <lightning:layout horizontalAlign="center"   >

       <lightning:layoutItem class="slds-grid_vertical-align-center" > 

           <lightning:select aura:id='typeSelect' label='Please select' name='selectItem' >
             <aura:iteration items='{!v.searchOptions}' var='option'>
                 <option value='{!option}' text='{!option}'></option>
             </aura:iteration>
         </lightning:select>
       </lightning:layoutItem>

       <lightning:layoutItem class="slds-grid_vertical-align-center" > 
         <lightning:button label="Search" variant="brand" onclick='{!c.onFormSubmit}' />
         <aura:if isTrue='{!v.showNewButton}'>
            <lightning:button variant='neutral' label='New' onclick='{!c.createBoat}'/>
        </aura:if>
       </lightning:layoutItem>

    </lightning:layout>

</aura:component>