1

How could it be accomplished to display the field name above the input field if the field is disabled? As of now, if the field is disabled, so is the e.fieldName attribute.

 <aura:iteration items="{!v.displayFields}" var="e">
    <div class="slds-grid">
        <aura:if isTrue="{!e.isDate}">
            <div id="inputFieldsCol1" class="slds-col slds-p-horizontal_medium">
                <ui:inputDate aura:id  = "selectedDate"
                              label    = "{!e.fieldName}"
                              value    = "{!e.fieldValue}"
                              format   = "MM/dd/yyyy/"
                              disabled = "{!e.disabled}"
                              displayDatePicker = "true"/>
            </div>
...

1 Answer 1

0

Assuming you want to show the label only when the field is disabled, you an use if expression.

So your inputDate will be

Assuming: e.disabled is a boolean :

<ui:inputDate aura:id  = "selectedDate"
      label    = "{!if(e.disabled,e.fieldName,'')}"
      value    = "{!e.fieldValue}"
      format   = "MM/dd/yyyy/"
      disabled = "{!e.disabled}"
      displayDatePicker = "true"/>

Assuming: e.disabled is a String :

<ui:inputDate aura:id  = "selectedDate"
          label    = "{!if(e.disabled=='true',e.fieldName,'')}"
          value    = "{!e.fieldValue}"
          format   = "MM/dd/yyyy/"
          disabled = "{!e.disabled}"
          displayDatePicker = "true"/>

Soruce: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/expr_functions.htm

2
  • That removes the display of the label entirely no matter if the field is enabled or disabled.
    – Jeff
    May 11, 2018 at 16:35
  • is e.disabled boolean or String? edited answer to support botth.. You can check which works for you. May 11, 2018 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.