Fix get-content-from-element
This commit is contained in:
parent
8189206ec6
commit
966ecf1009
1 changed files with 14 additions and 0 deletions
|
@ -36,6 +36,20 @@
|
||||||
:else
|
:else
|
||||||
content)))
|
content)))
|
||||||
|
|
||||||
|
(defn-spec get-content-from-element-2 js-object?
|
||||||
|
[name string?
|
||||||
|
& {:keys [deserializer optional]
|
||||||
|
:or {deserializer nil optional false}} dom-function-parameter]
|
||||||
|
(let [content (-> (get-element-by-id name)
|
||||||
|
(.-value))]
|
||||||
|
(cond
|
||||||
|
(and optional (st/blank? content))
|
||||||
|
nil
|
||||||
|
(some? deserializer)
|
||||||
|
(apply deserializer [content])
|
||||||
|
:else
|
||||||
|
content)))
|
||||||
|
|
||||||
(defn-spec set-validation-result! js-object?
|
(defn-spec set-validation-result! js-object?
|
||||||
[name string?
|
[name string?
|
||||||
validation-result js-object?]
|
validation-result js-object?]
|
||||||
|
|
Loading…
Reference in a new issue