I have a Lightning component with a list of the Account from Salesforce:

    <ui:inputSelect label="Account" class="form-control" aura:id="selectAccount"  onSelectChange="{!c.onSelectChange}">
        <aura:iteration items="{!v.accounts}" var="account">
            <ui:inputSelectOption value="{!account.Id}" label="{!account.Name}" />

It works right. How to retrive the Id of the selected account option? I'm expecting on the onSelectChange callback to see the params, but with:

onSelectChange: function(component, event, helper) {

I get this output:

app.js:14666 Event {source: Component, $eventDef$: EventDef, $eventDispatcher$: undefined, $eventName$: "change", $params$: Object…}
app.js:14667 Object {}

While I'm expecting to see at least the name of the Account..

Any advice?

  • input select option uder aurta:iteration , i am not able to access the value by component.get. but the same can be retrieved if the put the input select outside the aura:iteration. .... Is it work like that ? I get lightning error '$handleSave [Cannot read property 'get' of undefined]"'
    – Abhik Dey
    Apr 3, 2018 at 14:11

1 Answer 1


I see a few potential errors in the code. onSelectChange should be change, and value should be text.

Please try this:

<aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
<aura:attribute name="contacts" type="Contact[]"/>

<ui:inputSelect aura:id="o" label="Contacts" change="{!c.onSelectChange}">
    <aura:iteration items="{!v.contacts}" var="contact">
        <ui:inputSelectOption text="{!contact.Id}" label="{!contact.Name}" />

And then you can use the component.find().get() pattern to retrieve the Id.

onSelectChange : function(component, event, helper) {
    var selected = component.find("o").get("v.value");

doInit : function(component, event, helper) {
    // Your own implementation for loading records

Here are a few docs related to ui:inputSelect:

  • Thank you. I think that even if this stack exchange wth people (like you) that know the aura framework very well is a great tool.. documentation lacks a lot.
    – mcmc
    May 1, 2015 at 17:35
  • Spoke with my developers and they mentioned that you don't need array indexing anymore as of Spring '15. I updated the answer here and I'll be adding this to the ui:inputSelect docs as well. github.com/forcedotcom/aura/commit/… May 1, 2015 at 20:14

You must log in to answer this question.

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