[SalesForce] How to render the corresponding field-label automatically in Lightning

In Visualforce we used <apex:inputField value="{!account.name}"/> to get the html-input together with the right label (respecting transaltions, overrides, etc.)

Now in Lightnig is see a very verbose notation in the examples setting the label manually hardcoded like that:

<ui:inputText aura:id="client" 
    label="Client" 
    class="form-control"
    value="{!v.newExpense.Client__c}"
    placeholder="ABC Co."
/>

Is there a way to populate the labels dynamically like in VF?

The expression which works in Visualforce like this

{!$ObjectType.Account.fields.Name.Label}

seems not to work but brings up only empty-results in the markup of a Lightning Component. However you can save the markup containing the expression without any error.

Best Answer

I just have received this reply from premier+ support. Bottom line: it's not possible for now. No ETA and no infos about the roadmap yet.

Hi, Thanks for your time over the call. As discussed,

  • I have checked with Senior support Engineers and internal teams and as per our confirmation : All text fields must specify the label attribute to provide a textual label of the field.

  • Currently, these attributes are not completely exposed.

  • I have put forward your concerns regarding giving developers more leverage and exposures to develop more efficiently.

They also suggested that we put this in Ideas Exchange since this might be vital for other organizations in the future. Here again is the link:

http://ideas.salesforce.com

Related Topic