https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • f

    fancy-elephant-10660

    07/06/2022, 2:39 PM
    got it
  • m

    mysterious-toddler-20573

    07/06/2022, 2:39 PM
    you could also do this w/ an event filter, but I think this is cleaner and more async friendly
  • f

    fancy-elephant-10660

    07/06/2022, 2:40 PM
    btw: do you know some IDE pycharm plugins to read format the hyperscript and htmx
  • m

    mysterious-toddler-20573

    07/06/2022, 2:48 PM
    nope, not yet
  • m

    mysterious-toddler-20573

    07/06/2022, 2:48 PM
    but please harass JetBrains!
  • f

    fancy-elephant-10660

    07/06/2022, 2:50 PM
    done
  • m

    mysterious-toddler-20573

    07/06/2022, 3:37 PM
    HX-Boosted Anchor Targets and History ยท ...
  • p

    powerful-train-54786

    07/06/2022, 3:41 PM
    Is there a bigfunctionaly difference between doing something like
    hx-target="#target" hx-swap="beforeend"
    or just returning
    hx-swap-oob="beforeend#target
  • p

    powerful-train-54786

    07/06/2022, 3:41 PM
    to mee the former makes it clearer as to how the app functions, while the latter hides some of that since it's not co-located to where it's going to end up
  • m

    mysterious-toddler-20573

    07/06/2022, 3:46 PM
    I would prefer the former
  • m

    mysterious-toddler-20573

    07/06/2022, 3:46 PM
    but sometimes if you need to update multiple things, the latter is necessary
  • m

    mysterious-toddler-20573

    07/06/2022, 3:47 PM
    i tried to be pragmatic and give people a few escape hatches when necessary
  • p

    powerful-train-54786

    07/06/2022, 4:48 PM
    That makes sense
  • s

    steep-lamp-42308

    07/06/2022, 5:08 PM
    From another viewpoint it would be simpler if the returned elements always specified their swap/target and their child elements were applied, like oob elements are. It is a little confusing to have a response that has several form fields at the top level that are applied using the non-oob approach, plus some oob container elements at the top level, which is common for me at least -- there is an inconsistency there. I'm not complaining, just a comment in case simplifications were being considered for 2.0. In general I think the htmx approach is fantastic and I'm very happy using it.
  • s

    steep-lamp-42308

    07/06/2022, 5:15 PM
    Also my preference is to have one way of doing things instead of two.
  • p

    powerful-train-54786

    07/06/2022, 5:28 PM
    I tend to agree, if not we have to wait until so many htmx users have done it so many ways that we gravitate to commonly accepted idioms for common scenarios
  • p

    powerful-train-54786

    07/06/2022, 5:29 PM
    Which also is fine, because that tends to have more people thinking about the problems and offloads the work from the library dev
  • s

    steep-lamp-42308

    07/06/2022, 6:42 PM
    I'll try using all oob results to see if that is really simpler.
  • a

    ancient-shoe-86801

    07/06/2022, 8:25 PM
    wasn't Paul Everitt a big fan of htmx?
  • s

    steep-lamp-42308

    07/06/2022, 8:48 PM
    I tried it. It is more consistent to use oob for all the responses, but I'm not sure it's simpler. You need an additional id (if not already needed) that goes in the parent element as well as the oob response. (You also have to add
    hx-swap="none"
    in the parent element, but if everything was done oob then this wouldn't be needed.)
    p
    • 2
    • 1
  • a

    ancient-shoe-86801

    07/06/2022, 11:05 PM
    found the answer myself. Time to keep pestering JetbBains and Paul ๐Ÿ˜„ https://twitter.com/paulweveritt/status/1499079390596153347
  • p

    powerful-train-54786

    07/07/2022, 12:35 AM
    I tried it It is more consistent to use
  • p

    powerful-train-54786

    07/07/2022, 4:28 AM
    Foudn odd behavior, when I click a button that has an hx-get, and the response does an hx-swap-oob to another target, the text in the button itself disappears after the response does the swap
  • p

    powerful-train-54786

    07/07/2022, 4:45 AM
    had to use hx-swap="none" in that case on the button.
  • s

    some-diamond-25050

    07/07/2022, 6:35 AM
    I have similar issue. i show confirm dialog but on Yes I show OTP modal and what happens is as if that Yes click causes confirmed event while I want Yes to instead lead to OTP modal and on its success I need to trigger both closeModal and confirmed. can you guide ? https://github.com/bigskysoftware/htmx/discussions/951 row_ro.html has Delete action leading to Confirm Dialog. Earlier I did not have OTP dialog so it was working fine but with addition of OTP dialog I am facing issue that confirmation Yes causes UI row to be deleted from front end. backend its not deleted since it will delete on OTP match. tried htmx.logAll() and monitorEvents on gamelist table but could not still figure out.
  • f

    faint-beach-68980

    07/07/2022, 12:18 PM
    Out of curiosity, why are those ignored?
  • m

    mysterious-toddler-20573

    07/07/2022, 12:56 PM
    are you returning only the OOB swap?
  • m

    mysterious-toddler-20573

    07/07/2022, 12:56 PM
    You only want to include the value of the clicked button
  • m

    mysterious-toddler-20573

    07/07/2022, 12:59 PM
    we try our best, but it is (or was, haven't looked at the apis in a while) hard to get the source of the element that caused the submit: https://github.com/bigskysoftware/htmx/blob/299a9baa1df31bcee78f52677c4444095b5b3db2/src/htmx.js#L1676
  • p

    powerful-train-54786

    07/07/2022, 2:32 PM
    yes, only the oob swap component is returned, I had to put hx-swap="none" to get it to not swap the button contents. I also noticed that when I do an oob swap with something like
    beforeend:#someID
    in some cases the child elements of that one are put in that location, not the entire outerhtml
1...736737738...1146Latest