|
|
|
@ -54,11 +54,11 @@
|
|
|
|
|
true
|
|
|
|
|
(:form-specs form-def)))
|
|
|
|
|
|
|
|
|
|
(defn field-specs-valid? [form-def data]
|
|
|
|
|
(defn field-specs-valid? [form-def req]
|
|
|
|
|
(reduce-kv
|
|
|
|
|
(fn [result field field-def]
|
|
|
|
|
(if-let [field-spec (:spec field-def)]
|
|
|
|
|
(if (spec/valid? field-spec (field data))
|
|
|
|
|
(if (spec/valid? field-spec (get-in req [:params field]))
|
|
|
|
|
true
|
|
|
|
|
(reduced false))
|
|
|
|
|
result))
|
|
|
|
@ -68,7 +68,7 @@
|
|
|
|
|
(defn valid? [form-def req]
|
|
|
|
|
{:pre [(spec/assert ::form form-def)]}
|
|
|
|
|
(let [data (form-data form-def req)]
|
|
|
|
|
(and (field-specs-valid? form-def data)
|
|
|
|
|
(and (field-specs-valid? form-def req)
|
|
|
|
|
(form-specs-valid? form-def req))))
|
|
|
|
|
|
|
|
|
|
(def ^:dynamic *row-theme* theme/row)
|
|
|
|
@ -93,7 +93,9 @@
|
|
|
|
|
:mselect *mselect-widget-theme*
|
|
|
|
|
:hidden *hidden-widget-theme*
|
|
|
|
|
*input-widget-theme*)]
|
|
|
|
|
(*row-theme* (when (and validate? (not (spec/valid? spec req-value)))
|
|
|
|
|
(*row-theme* (when (and validate?
|
|
|
|
|
spec
|
|
|
|
|
(not (spec/valid? spec req-value)))
|
|
|
|
|
(*widget-error-theme* id def req-value))
|
|
|
|
|
(*label-theme* id def)
|
|
|
|
|
(renderer id def (if validate? req-value value)))))
|
|
|
|
|