Skip to content

Instantly share code, notes, and snippets.

@facundoolano
Created December 4, 2017 14:52
Show Gist options
  • Save facundoolano/1aafe31609a90bc92f558e680c0aa087 to your computer and use it in GitHub Desktop.
Save facundoolano/1aafe31609a90bc92f558e680c0aa087 to your computer and use it in GitHub Desktop.
forms2.clj
(re-frame/reg-sub
:valid-required?
(fn [db [_ value]]
(if (string/blank? value)
[false "This field is required."]
[true])))
(re-frame/reg-sub
:valid-form?
(fn [[_ form fields]]
(->> fields
(get-validation-subs form)
(map re-frame/subscribe)
(doall)))
(fn [validations _]
(every? true? (map first validations))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment