|
|
@ -54,11 +54,11 @@
|
|
|
|
true
|
|
|
|
true
|
|
|
|
(:form-specs form-def)))
|
|
|
|
(:form-specs form-def)))
|
|
|
|
|
|
|
|
|
|
|
|
(defn field-specs-valid? [form-def data]
|
|
|
|
(defn field-specs-valid? [form-def req]
|
|
|
|
(reduce-kv
|
|
|
|
(reduce-kv
|
|
|
|
(fn [result field field-def]
|
|
|
|
(fn [result field field-def]
|
|
|
|
(if-let [field-spec (:spec 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
|
|
|
|
true
|
|
|
|
(reduced false))
|
|
|
|
(reduced false))
|
|
|
|
result))
|
|
|
|
result))
|
|
|
@ -68,7 +68,7 @@
|
|
|
|
(defn valid? [form-def req]
|
|
|
|
(defn valid? [form-def req]
|
|
|
|
{: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 req)
|
|
|
|
(form-specs-valid? form-def req))))
|
|
|
|
(form-specs-valid? form-def req))))
|
|
|
|
|
|
|
|
|
|
|
|
(def ^:dynamic *row-theme* theme/row)
|
|
|
|
(def ^:dynamic *row-theme* theme/row)
|
|
|
@ -93,7 +93,9 @@
|
|
|
|
:mselect *mselect-widget-theme*
|
|
|
|
:mselect *mselect-widget-theme*
|
|
|
|
:hidden *hidden-widget-theme*
|
|
|
|
:hidden *hidden-widget-theme*
|
|
|
|
*input-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))
|
|
|
|
(*widget-error-theme* id def req-value))
|
|
|
|
(*label-theme* id def)
|
|
|
|
(*label-theme* id def)
|
|
|
|
(renderer id def (if validate? req-value value)))))
|
|
|
|
(renderer id def (if validate? req-value value)))))
|
|
|
|