This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-30
Channels
- # aleph (2)
- # announcements (8)
- # babashka (12)
- # beginners (34)
- # calva (36)
- # cherry (3)
- # cider (1)
- # clj-kondo (11)
- # clj-otel (6)
- # cljdoc (31)
- # clojure (121)
- # clojure-conj (1)
- # clojure-czech (2)
- # clojure-europe (109)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (3)
- # cursive (3)
- # datahike (1)
- # datomic (9)
- # deps-new (6)
- # docker (5)
- # emacs (21)
- # fulcro (4)
- # hoplon (16)
- # introduce-yourself (2)
- # london-clojurians (5)
- # lsp (87)
- # malli (17)
- # missionary (1)
- # nbb (27)
- # off-topic (257)
- # pathom (4)
- # portal (42)
- # practicalli (1)
- # rdf (3)
- # releases (2)
- # shadow-cljs (49)
- # slack-help (3)
- # timbre (2)
How to change a defattr defined variable in an edit form in the fo/trigger :on-change ? I tried 2 different approaches - both are being triggered but the variable for "inactive-date" is not being set. a) apply-action:
fo/triggers {:on-change (fn [{::uism/keys [state-map] :as uism-env} form-ident key old-value new-value]
(case key
:member/active?
(let [target-path (conj form-ident :member/inactive-date)]
(when (not new-value) (uism/apply-action uism-env assoc-in target-path (datetime/now)))))
;; default
uism-env)}
b) set-value:
fo/triggers {:on-change (fn [{::uism/keys [state-map] :as uism-env} form-ident key old-value new-value]
(case key
:member/active?
(when (not new-value) (uism/set-value! this state-map :member/inactive-date (datetime/now))))
;; default
uism-env)}
The idea is that if the attribute "active?" is being set to false then my inactive-date should be set to datetime/now.
btw:
[com.fulcrologic.rad.type-support.date-time :as datetime]
Any advice is being appreciated! 😄2 things: • I don't think you have access to "this" in the trigger so you can't use it, but you have uism-env • what happens when new-value is true? I think you will have issues if you don't return the uism-env in the trigger
is :member/inactive-date in your form attributes? or in the query inclusions?