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