1

I have two lightning:button and a lightning:input field. What I have seen in some places is that. Some buttons are enabled only when values are entered in the text boxes. Is this achievable in lightning

1 Answer 1

3

We use the disabled attribute of the ui:button || lightning:button components. Here is an example.

<aura:component>

  <aura:attribute name="username" type="String" default="" />


  <ui:inputText required="true" value="{!v.username}" label="Username" updateOn="keyup" />
  <ui:button disabled="{!empty(v.username)}" class="slds-button_brand" label="Submit" />

</aura:component>

PS: I have used the ui:* components here you can use the lightning:* components.

You must log in to answer this question.

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