reagent-project / reagent-forms

Bootstrap form components for Reagent
339 stars 78 forks source link

Wrap-fns for re-frame mode #139

Closed smogg closed 6 years ago

smogg commented 6 years ago

As per discussion in #138, wrap-fns is required for save-fn, in-fn and similar to work.

yogthos commented 6 years ago

👍

yogthos commented 6 years ago

So, I was thinking, with the external data source mode we're currently doing (make-form form (assoc doc :doc (:get doc)) false), but I think :doc should really be a function that's passed in by the caller, and it should return the current state of the document.

yogthos commented 6 years ago

I made a new branch for the feature here, it would be good to also add the support for validation, and a possibly a general on-change function from this issue.

yogthos commented 6 years ago

and pushed out a new release with a few updates, I ended up changing the behavior re-frame subscriptions a bit. Instead of giving an event key, its better to just pass a function that handles the re-frame event.