You need to sign in to do that
Don't have an account?
Peter McGavin
The Name field is not being displayed using an expression.
Hi,
I am stuck on the Atttributes and Expressions challenge of the lightening component basics:
I get the following message: The Name field is not being displayed using an expression.
I'm really not 100% sure how the display component is meant to work for Name and Packed status - as there seems to be no "<lightening: /> formatting markup available.
Here is my code:
<aura:component>
<aura:attribute name="item" type="Camping_Item__c" required="true" />
<aura:attribute name="expense" type="Expense__c"/>
<p>Name:
<lightning:String value="{!v.item.Name__c}" style="Text"/>
</p>
<p>Price:
<lightning:formattedNumber value="{!v.item.Price__c}" style="Currency"/>
</p>
<p>Quantity:
<lightning:formattedNumber value="{!v.item.Quantity__c}" style="Number"/>
</p>
<p>Packed Status:
<lightning:Checkbox value="{!v.item.Packed__c}" style="Toggle"/>
</p>
</aura:component>
Thanks for your assistance in advance.
I am stuck on the Atttributes and Expressions challenge of the lightening component basics:
I get the following message: The Name field is not being displayed using an expression.
I'm really not 100% sure how the display component is meant to work for Name and Packed status - as there seems to be no "<lightening: /> formatting markup available.
Here is my code:
<aura:component>
<aura:attribute name="item" type="Camping_Item__c" required="true" />
<aura:attribute name="expense" type="Expense__c"/>
<p>Name:
<lightning:String value="{!v.item.Name__c}" style="Text"/>
</p>
<p>Price:
<lightning:formattedNumber value="{!v.item.Price__c}" style="Currency"/>
</p>
<p>Quantity:
<lightning:formattedNumber value="{!v.item.Quantity__c}" style="Number"/>
</p>
<p>Packed Status:
<lightning:Checkbox value="{!v.item.Packed__c}" style="Toggle"/>
</p>
</aura:component>
Thanks for your assistance in advance.
Also I suggest you double check field "Name" it's may not be a custom one, but standard Name field. Hope it would help.
All Answers
Also I suggest you double check field "Name" it's may not be a custom one, but standard Name field. Hope it would help.
I get the message: Failed to save campingListItem.cmp: The attribute "style" was not found on the COMPONENT markup://lightning:formattedText: Source
<lightning:formattedText value="{!v.item.Name}" />
You may want to look at this API Documentation reference https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_lightning_formattedText.htm (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_compref_lightning_formattedText.htm). Would be very useful.
<aura:component >
<aura:attribute name="item" type="Camping_Item__c" required="true" />
<p>Name:
<lightning:formattedText value="{!v.item.Name}" />
</p>
<p>Quantity:
<lightning:formattedNumber value="{!v.item.Quantity__C}" style="Number"/>
</p>
<p>Price:
<lightning:formattedNumber value="{!v.item.Price__c}" style="currency"/>
</p>
<p>
<lightning:input type="toggle"
label="Packed"
name="Packed"
checked="{!v.item.Packed__c}" />
</p>
</aura:component>
As you are supposed to display values using three different ways, my code shows one section for each of the three ways of displaying the required data.