|
|
|
@ -46,9 +46,9 @@
|
|
|
|
|
{}
|
|
|
|
|
(:fields form-def)))
|
|
|
|
|
|
|
|
|
|
(defn form-specs-valid? [form-def data]
|
|
|
|
|
(reduce (fn [valid? field-spec]
|
|
|
|
|
(if (spec/valid? field-spec data)
|
|
|
|
|
(defn form-specs-valid? [form-def req]
|
|
|
|
|
(reduce (fn [valid? form-spec]
|
|
|
|
|
(if (spec/valid? form-spec req)
|
|
|
|
|
true
|
|
|
|
|
(reduced false)))
|
|
|
|
|
true
|
|
|
|
@ -69,7 +69,7 @@
|
|
|
|
|
{:pre [(spec/assert ::form form-def)]}
|
|
|
|
|
(let [data (form-data form-def req)]
|
|
|
|
|
(and (field-specs-valid? form-def data)
|
|
|
|
|
(form-specs-valid? form-def data))))
|
|
|
|
|
(form-specs-valid? form-def req))))
|
|
|
|
|
|
|
|
|
|
(def ^:dynamic *row-theme* theme/row)
|
|
|
|
|
(def ^:dynamic *widget-error-theme* theme/widget-error)
|
|
|
|
@ -111,7 +111,8 @@
|
|
|
|
|
(spec/explain-data ::form form-def))))
|
|
|
|
|
(let [validate? (validate? form-def values req)
|
|
|
|
|
form-errors (when (and validate?
|
|
|
|
|
(not (form-specs-valid? form-def req)))
|
|
|
|
|
(not (form-specs-valid? form-def
|
|
|
|
|
req)))
|
|
|
|
|
(*form-error-theme* form-def req))
|
|
|
|
|
widget-mapper (partial widget-markup values req validate?)
|
|
|
|
|
defined-widgets (map widget-mapper (:fields form-def))
|
|
|
|
|