2

I have used custom label in messageWhenValueMissing attribute but it doesn't get displayed in UI.

Is there a way to use custom label in messageWhenValueMissing. This is necessary since multiple countries will be using the component and they need it in their own language.

<lightning:select label="Reason" value="{!v.reasonValue}" required="true" 
 messageWhenValueMissing="{!$label.c.please_provide_reason}">
1
  • did you try by setCustomValidity?
    – sdandamud1
    May 14, 2019 at 14:41

1 Answer 1

2

It seems the keyword Label is case sensitive in this context. With a quick test I was able to reflect the message from a custom label using Label (starting with UPPERCASE L).

Change the keyword from label to Label and that should work, as below:

<lightning:select label="Reason" value="{!v.reasonValue}" required="true" 
                  messageWhenValueMissing="{!$Label.c.please_provide_reason}">
2
  • Yes this works, looks like Label is case sensitive only in such scenarios cuz this works correctly <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">{!$label.c.Select_reason_for_reopenin}</h2>
    – devforce
    May 14, 2019 at 14:59
  • Yeah, that's a bit odd. I would have expected this to have the same behavior everywhere but doesn't seem to be the case.
    – Jayant Das
    May 14, 2019 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .