Skip to main content
1 of 5
Jason Benkert
  • 2.2k
  • 3
  • 18
  • 32

target.getSource() not working for ui:inputNumber in Lightning Component

I have a component that displays several different input types, such as ui:inputText and ui:inputNumber. Each input uses an onchange="{!c.handleChange}" attribute.

In my controller, the handleChange method then gets the value of the field. However, ui:inputNumber fields aren't working. The sandbox I'm in was just updated to Winter 18 - so wondering if this has something to do with it.

Here's my component snippet:

<ui:inputText onchange="{!c.handleChange}" />
<ui:inputNumber onchange="{!c.handleChange}" />

And in my controller:

handleChange : function(component,event,helper){
    // this works fine for all types except inputNumber
    console.log(event.getSource().get('v.value'));
}

Using the above, ui:inputNumber results in undefined. I've also tried the old event.target.value, however event.target is undefined.

Any thoughts?

Jason Benkert
  • 2.2k
  • 3
  • 18
  • 32