reagent-project / reagent-forms

Bootstrap form components for Reagent
339 stars 78 forks source link

Consider using `input` event rather than `change` #78

Closed eyelidlessness closed 6 years ago

eyelidlessness commented 8 years ago

The current behavior of bind-fields uses the change event to update bindings. The behavior of the change event is such that the state will not update until a form field is blurred. This means that, for forms with an :onSubmit handler, if a user presses enter within a modified form field, the state of the bound atom will reflect its old value.

The input event (supported by all modern browsers, IE9+) would fire anytime the input value changes, thereby ensuring the bound atom is never out of sync.

yogthos commented 8 years ago

That makes sense, would you be up for making a pr for this?

eyelidlessness commented 8 years ago

I'd love to. Is the browser support baseline acceptable?

yogthos commented 8 years ago

Yeah definitely, can just add a note in the readme that this works with ie9+.