New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
input action on="change" does not fire #11678
Comments
strange: work around: http://emberjs.jsbin.com/yedigeyeda/1/edit?html,js,console,output |
This is similar to #10305 |
this is really annoying in acceptance tests, where the
if I want events to properly fire (since I can't use the change event, which probably would be triggered by |
Apologies, I only wanted to point out that 'keyup' is not a feasible workaround, so in a sense it's related. :) |
@stefanpenner: @JKGisMe and I recently discovered that using the (twiddle by @JKGisMe) |
Actually a lot of events don't work on the input helper right now, including anything mouse related. |
Ya, I'm tracking this. Will try to fill in what is happening when not mobile. |
This is a serious problem. Setting two and more actions can't be don't for input helper. Can't believe that Ember 2.0.0 still hasn't such attributes like on-input="" and on-change="". |
I haven't tested all the actions but I just successfully used this: {{input
value=value
autoresize=true
focus-in="inputFocusIn"
focus-out="inputFocusOut"
enter="removeFocus"
}} You can also just use the old fashioned html version and hbs actions to achieve it. <input
value={{someValue}}
onblur={{action checkForValid value="target.value"}}
oninput={{action validate value="target.value"}}
/> |
Right now it supports these:
|
Ya, I thought that this issue was reporting a regression with This is specifically about using |
ok so yes, i have to add a Which leads me to wonder... what's the point of having an |
@JKGisMe - Huh? How is |
So in the twiddle linked above... How would you do all those in with the In my work project, I inadvertently ended up using the html way for all input boxes before this got brought up but now I'm wondering if it was bc I have a ton of actions attached to events that just worked this way.... :P too bad the dev doesn't actually remember. |
@rwjblue My expectation when using the Reading the guide on this is most misleading because there is no mention of what you cannot use for an input. http://guides.emberjs.com/v2.0.0/templates/input-helpers/ Especially, the actions section gives you a link to all events and tells you to just dasherize them. It isn't until you dig in and finally reach this page: http://emberjs.com/api/classes/Ember.Templates.helpers.html#method_input Starting with this statement: "The helper allows some user events to send actions." That you realize you aren't going crazy and I'm not saying that's wrong; just unexpected. This caused me to jump into Slack and ask why. I was greeted with people as perplexed as I was. |
I wonder if there is already an update on this |
I'm new to Ember and spent the last hour tracking this one down. Unsure if this is because I'm a recent convert from Angular and I'm used to having Right now I'm still not sure what actions are or have a feel for what they mean to me so I didn't even know what to search for. Regardless, I adore this framework. Coming from Angular, everything here feels well thought out and far more consistent. Edit: No actions required from this post. I was just giving feedback. |
@rwjblue @morganick I got bitten by this miss-understanding too. Is the following a correct, though simplified guideline on when to use what form for an input in a component?
I also think that we should change the Actions & Checkboxes section here. *... IMO The only way to register an action handler and access the checkbox's checked value reliably is to use the form |
I was having issues with this as well as I needed to change a save button if values of the inputs changed. I found that if you set your inputs inside a form and set the action "change" on the form itself it will run the action any time one of the inputs within the form is changed. Twiddle here: https://ember-twiddle.com/?openFiles=templates.application.hbs%2C See Event Names here: http://emberjs.com/api/classes/Ember.View.html#toc_event-names If this isn't the problem you are having please just ignore this 😄 . |
@jfuqua390 Your twiddle link BTW, just giving my solution to whoever comes here. <input
multiple="true"
onchange={{action "upload"}}
accept="image/png,image/jpeg,application/pdf"
type="file"
/> actions: {
upload: function(event) {
console.log('upload');
}
} |
@ldong I tried your work around (admittedly on an old version of ember) and received the following error:
Not sure if I'm missing something? |
To anyone still struggling with this, this seems to work just fine:
Copied from Stackoverflow |
@EricSchank @Fryie @JKGisMe @MarkMT @SillyButt @abepetrillo @davidsteinberger @greyhwndz @jcfinnerup @jfuqua390 @ldong @locks is this still an issue, perhaps we should close or create a new reproduction of this, what do you think? |
Closing for now there are plenty of ways to create a working change event |
@jcfinnerup any ideas on how to test this? How would you create the input event (with a helper like triggerEvent) ? |
The change event does not seem to work for actions on the input helper.
Example for range input: http://emberjs.jsbin.com/zisejusahi/edit?html,js,output
Example for text input: http://emberjs.jsbin.com/piqelexime/1/edit?html,js,output
The text was updated successfully, but these errors were encountered: