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

    witty-doctor-93385

    12/21/2022, 9:30 PM
    I also use this solution because I dont understand the hx-swap-oob in my situation haha
  • m

    mammoth-family-48524

    12/21/2022, 9:54 PM
    Not sure if it helps but the oob swap supports matching using any css selector - such as classes. You could match the buttons inside the loop using that perhaps
  • b

    bulky-kilobyte-96254

    12/21/2022, 9:55 PM
    Issue with that was that theres multiple of those buttons available, so I'd have to make them unique which sounds like a lot of bs to do
  • b

    bulky-kilobyte-96254

    12/21/2022, 9:55 PM
    But currently just replacing the products list as a whole, which works fine
  • h

    hundreds-camera-24900

    12/22/2022, 12:13 AM
    this is a no duh in retrospect, but if you but
    hx-trigger
    onto a boosted form and don't add
    submit
    as a target type, it will no longer be boosted
  • t

    tall-dinner-62086

    12/22/2022, 12:52 AM
    Thinking of making an extension to add an
    HX-Select
    header to requests made with an
    hx-select
    attribute to tell the backend what it actually needs to return. This would work nicely with laravel's fragment feature and probably other backends so you're only returning the html that's actually gonna be used. Thoughts?
  • h

    hundreds-camera-24900

    12/22/2022, 12:53 AM
    it makes sense to me
  • t

    tall-dinner-62086

    12/22/2022, 12:53 AM
    Not quite sure how I'm gonna handle out of band swaps
  • t

    tall-dinner-62086

    12/22/2022, 12:53 AM
    Because those can be outside of the selected fragment
  • t

    tall-dinner-62086

    12/22/2022, 12:54 AM
    But I think it's gonna be one of those things that is helpful in 80% of cases
  • h

    hundreds-camera-24900

    12/22/2022, 12:54 AM
    that would be the endpoint's call on what to return anyway
  • h

    hundreds-camera-24900

    12/22/2022, 12:55 AM
    so you'd just have to decide "return more than just the fragment" on a case by case basis,
  • h

    hundreds-camera-24900

    12/22/2022, 12:55 AM
    Is there a way with hx-trigger to target multiple sources of events?
  • h

    hundreds-camera-24900

    12/22/2022, 12:55 AM
    EG something like
    hx-trigger="keyup changed delay:500ms, search, submit"
    for one of many fields in a form
  • t

    tall-dinner-62086

    12/22/2022, 12:56 AM
    hx-trigger doesn't care about the "source" of the event
  • t

    tall-dinner-62086

    12/22/2022, 12:57 AM
    An event either reaches it or doesn't
  • h

    hundreds-camera-24900

    12/22/2022, 12:57 AM
    that makes sense, but that is not what I"m seeing 😕
  • t

    tall-dinner-62086

    12/22/2022, 12:58 AM
    I may be misunderstanding what you mean. Post code.
  • h

    hundreds-camera-24900

    12/22/2022, 12:58 AM
    more likely it's an error on my part, but:
  • h

    hundreds-camera-24900

    12/22/2022, 1:00 AM
    Copy code
    html
    <form action="/account/members/" hx-trigger="keyup changed delay:500ms, search, submit" hx-indicator=".htmx-indicator" hx-target="#member-list" hx-swap="outerHTML" hx-select="#member-list">
        <label for="id_search">
              search:
            </label>
        <input id="id_search" type="text" name="search" value="gone">
    </form>
  • h

    hundreds-camera-24900

    12/22/2022, 1:00 AM
    I would expect keyup on #id_search to bubble to the form and trigger the hx-trigger
  • t

    tall-dinner-62086

    12/22/2022, 1:01 AM
    ah
  • t

    tall-dinner-62086

    12/22/2022, 1:01 AM
    Try
    from:#id_search'
  • t

    tall-dinner-62086

    12/22/2022, 1:01 AM
    as in
    keyup changed delay:500ms from:#id_search
  • h

    hundreds-camera-24900

    12/22/2022, 1:02 AM
    I'm planning on having several similar filters
  • h

    hundreds-camera-24900

    12/22/2022, 1:02 AM
    so that's why the multiple sources
  • h

    hundreds-camera-24900

    12/22/2022, 1:02 AM
    EG I'll have 3/4 select inputs other than search, so I was hoping I could from:.selector
  • h

    hundreds-camera-24900

    12/22/2022, 1:03 AM
    one option would be to articulate them individually which isn't unresonable, I think I have like 6 in total
  • h

    hundreds-camera-24900

    12/22/2022, 1:03 AM
    but would be easier to do like
    from:select
  • t

    tall-dinner-62086

    12/22/2022, 1:03 AM
    from:
    takes an extended css selector so it could just be
    from:form>input
1...956957958...1146Latest