single event for handling changes.

This commit is contained in:
Bryce Covert
2019-04-26 14:32:37 -07:00
parent 5d5db63ed6
commit 48a8e0ce9f
3 changed files with 34 additions and 12 deletions

View File

@@ -107,11 +107,18 @@
]
children)))
:raw-field (fn [control]
(let [{:keys [data]} @(re-frame/subscribe [::form id])]
[bind-field (-> control
(assoc-in [1 :subscription] data)
(assoc-in [1 :event] change-event))]))
:field (fn [label control]
(let [{:keys [data]} @(re-frame/subscribe [::form id])]
[:div.field
(when label [:p.help label])
[:div.control [bind-field (assoc-in control [1 :subscription] data)]]]))
[:div.control [bind-field (-> control
(assoc-in [1 :subscription] data)
(assoc-in [1 :event] change-event))]]]))
:error-notification (fn []
(when-let [error (:error @(re-frame/subscribe [::form id]))]