You need to sign in to do that
Don't have an account?
Harsh Vardhan Agrawal 6
Access Check Failed! AttributeSet.get(): attribute 'carType' of component 'markup://c:CarSearchForm {326:0}' is not visible to 'markup://c:CarSearchForm {326:0}'.
I am getting the above error for my code below. Can someone please explain what the issue might be ?
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId">
<aura:attribute name="buttonlabel1" type="String" default="Search Button"/>
<aura:attribute name="buttonlabel2" type="String" default="New Button"/>
<aura:attribute name="isNewAvailable" type="Boolean" default="false"/>
<aura:attribute name="carTypes" type="String[]" default="['Hatchback','Sedan','Sports','SUV']"/>
<lightning:layout horizontalAlign="center">
<lightning:layoutItem padding="around-medium">
<lightning:select name="selectItem" aura:id = "carType" label="Select Car Type" variant="label-hidden" class="label-hidden" value="1">
<option value ="1" text = "All Types"/>
<aura:iteration items="{!v.carTypes}" var="carType">
<option value ="{!v.carType}" text="{!v.carType}"/>
</aura:iteration>
</lightning:select>
</lightning:layoutItem>
<lightning:layoutItem padding="around-medium">
<lightning:button label="{!v.buttonlabel1}" variant="brand"/>
<!-- display new button on availibility-->
<aura:if isTrue="{!v.isNewAvailable}">
<lightning:button label = "{!v.buttonlabel2}" variant="neutral"/>
<aura:set attribute = "else">
New Button cannot be added here
</aura:set>
</aura:if>
</lightning:layoutItem>
</lightning:layout>
</aura:component>
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId">
<aura:attribute name="buttonlabel1" type="String" default="Search Button"/>
<aura:attribute name="buttonlabel2" type="String" default="New Button"/>
<aura:attribute name="isNewAvailable" type="Boolean" default="false"/>
<aura:attribute name="carTypes" type="String[]" default="['Hatchback','Sedan','Sports','SUV']"/>
<lightning:layout horizontalAlign="center">
<lightning:layoutItem padding="around-medium">
<lightning:select name="selectItem" aura:id = "carType" label="Select Car Type" variant="label-hidden" class="label-hidden" value="1">
<option value ="1" text = "All Types"/>
<aura:iteration items="{!v.carTypes}" var="carType">
<option value ="{!v.carType}" text="{!v.carType}"/>
</aura:iteration>
</lightning:select>
</lightning:layoutItem>
<lightning:layoutItem padding="around-medium">
<lightning:button label="{!v.buttonlabel1}" variant="brand"/>
<!-- display new button on availibility-->
<aura:if isTrue="{!v.isNewAvailable}">
<lightning:button label = "{!v.buttonlabel2}" variant="neutral"/>
<aura:set attribute = "else">
New Button cannot be added here
</aura:set>
</aura:if>
</lightning:layoutItem>
</lightning:layout>
</aura:component>
Change this piece of code :
<aura:iteration items="{!v.carTypes}" var="carType">
<option value ="{!carType}" text="{!carType}"/>
</aura:iteration>
Cheers!!!