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

Add onFormChange action or equivalent #21

Closed samchrisinger closed 8 years ago

samchrisinger commented 8 years ago

I'd like to be able to run an action whenever the content of the form changes.

My use case is a dynamic-form that gets used to render some UI. I'd like to offer live preview for the changes a user makes in the form: screen shot 2016-02-08 at 11 11 19 am

My component structure involves an 'editor' that exposes a computed property for the schema of the dynamic form component. My understanding of Ember's data flow is that the dynamic form component should not mutate the parent's data, rather it should call an action to update that data. It looks like alpaca supports observing form changes: http://www.alpacajs.org/docs/api/observables.html.

Does this seem like a legitimate use case? I'd be happy to implement this feature.

toddjordan commented 8 years ago

Hey! yes its legit :-) Your case is something we're working on and expect in the next release within the next couple of weeks. We'd like to support both data binding and the ability to add event listeners.

At the moment you can supply a form action function which will render a button, where you could show your preview, but it sounds like you would like the preview updated as you update fields.

For that case at the moment you can supply your change function directly to the form schema per the aplaca documentation.

I'll go ahead and keep this issue open to track. I might ping you if I need implementation help

samchrisinger commented 8 years ago

:+1:, thanks!

toddjordan commented 8 years ago

Merged and cut release 0.0.8 to npm. Also updated docs site http://toddjordan.github.io/ember-cli-dynamic-forms/#/demos/change-action