Say I have a component in the markup:

<lightning:select aura:id="mySelect" ......>

No value attribute is set as if it defaults to a value it does not set the value of the attribute to the default value (only sets the html element as selected) so that is useless and the value has to be set manually in the controller. This means one has to add an option like "Please select a value" to ensure the value gets set appropriately

Now, say I have a button that I want to be disabled if no value is selected yet:

<button disabeld="{!??????}" ....>

Is there a way to reference the select value within the markup itself?

I am trying to have the button be disabled if the select value is blank and enabled when something has been selected.

I know I can do it in the event of the select or via an additional attribute but I am trying to not add any ore attributes than needed. There is already too many just to get around bugs etc so they have loaded the markup already.

I basically am just curious if a component value can be referenced directly in the markup.

  • You mean reference a button attribute from one other part of the markup (so no Js controller) but without creating an aura:attribute ? Commented Mar 18, 2017 at 11:03
  • The attribute I am after the the selects value to see if it is empty/blank
    – Eric
    Commented Mar 18, 2017 at 13:34

1 Answer 1


Not sure if this is what you want, but without an explicit attribute you can use cmp.find("mySelect").get("v.value") in your JS Controller, as described in the doc.

  • Thanks, but the whole point of the question is to be able to do this without the additional overhead of adding code to the controller or more attributes. The main cause of the problem is the fact that the default value of the select does not update the selects attribute so can't bind to the same attribute to check for disabled
    – Eric
    Commented Mar 20, 2017 at 15:32
  • So without attribute or JS Controller I'm afraid you can't do it. Commented Mar 21, 2017 at 10:40

You must log in to answer this question.

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