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.