diff --git a/src/main/cljs/dda/c4k_common/browser.cljs b/src/main/cljs/dda/c4k_common/browser.cljs index 9c7b34f..22d85e9 100644 --- a/src/main/cljs/dda/c4k_common/browser.cljs +++ b/src/main/cljs/dda/c4k_common/browser.cljs @@ -36,6 +36,20 @@ :else 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? [name string? validation-result js-object?]