This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-17
Channels
- # announcements (8)
- # babashka (27)
- # beginners (60)
- # biff (7)
- # calva (3)
- # cider (10)
- # cljs-dev (69)
- # clojure (18)
- # clojure-europe (12)
- # clojure-hungary (1)
- # clojure-korea (2)
- # clojure-new-zealand (12)
- # clojure-nl (1)
- # clojure-norway (80)
- # clojure-uk (9)
- # clojurescript (55)
- # cursive (69)
- # data-science (16)
- # events (5)
- # helix (11)
- # hyperfiddle (23)
- # jobs (1)
- # lsp (5)
- # malli (14)
- # matrix (1)
- # missionary (2)
- # off-topic (40)
- # portal (31)
- # re-frame (17)
- # reitit (11)
- # releases (11)
- # shadow-cljs (4)
- # squint (4)
- # tools-deps (5)
- # yamlscript (4)
anyone had issues with hx-put requests in certain browsers? Several forms I have work in Firefox but fail update in Chrome/Safari. Not sure what the issue is.
It’s not the method… I tried converting it to a POST and that also fails. Other forms are working, so I’ll see if I can figure out what the difference is. (I realize this isn’t an htmx channel, but thought I’d ask anyway 🙂 )
htmx stuff is definitely relevant 🙂 . might be something up with the CSRF token? that's what I'd look into first.
For htmx requests that gets inserted here: https://github.com/jacobobryant/biff/blob/146f2b1c8e0563bd288795851beae8b985cacac7/starter/src/com/example/ui.clj#L53
AFAICT, it's got something to do with how the form
tag is handled by Chrome/Safari when inside a tr
. I got the request working in an unstyled way by not nesting the inputs... I'll return to making it beautiful later 🙂
It looks like this is a limitation of HTML/browsers. Here's a workaround: https://htmx.org/examples/edit-row/
I worked this up and have it working:
(defn form-tr
[{:keys [hidden] :as opts} & body]
[:tr (-> (merge {:hx-target "closest tr"
:hx-trigger "submit"} opts)
(dissoc :hidden)
(assoc-in [:style :margin-bottom] 0))
[:td.hidden
(for [[k v] (assoc-some hidden "__anti-forgery-token" anti-forgery/*anti-forgery-token*)]
[:input {:type "hidden"
:name k
:value v}])]
body])
The UX is not as clean as a form (I need to figure out how to trigger submission on enter, etc.), but it at least works and gets laid out correctly.