toddjordan / ember-cli-dynamic-forms

An Ember addon for creating dynamic forms
http://toddjordan.github.io/ember-cli-dynamic-forms/
MIT License
35 stars 16 forks source link

Support closure actions for handling changes to the form #25

Closed toddjordan closed 8 years ago

toddjordan commented 8 years ago

Addresses issue #21 Adding the ability for parent components to listen/react to changes in the form.

Allows the developer using dynamic forms to pass a closure action and have that action executed whenever a form field is changed.

toddjordan commented 8 years ago

cc @samchrisinger

This is the approach I'm looking to take for issue #21. Still work in progress due to a mysterious phantomjs error I'm looking at, and I'm working on adding docs as well. Feel free to take a look though. I'm essentially just assigning a change handler on each field on the form, which will invoke the action. From the action you get the event object and can gain access to the field updated as well as other stuff int he form. I'll add an example in the docs. You can also look at the test for it too for usage.

toddjordan commented 8 years ago

Fixed the issue around phantom and added docs

samchrisinger commented 8 years ago

This looks great!

toddjordan commented 8 years ago

@samchrisinger this pr has the action firing on change (which doesn't fire until you blur from the field). Which is preferable, on change or on keypress?

samchrisinger commented 8 years ago

Keypress is much more useful to me.

toddjordan commented 8 years ago

Alright, I'll make an update to make that happen

toddjordan commented 8 years ago

@samchrisinger updated!

samchrisinger commented 8 years ago

Thanks so much! This will be a huge help for us.