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

    busy-dinner-85754

    02/10/2023, 2:06 AM
    Hmm ... it just occurred to me that for a 204, there is probably no swap or settle triggered πŸ˜„
  • s

    salmon-church-58191

    02/10/2023, 4:31 AM
    You are a total angel. You figured out what I was too clueless to explain: the click hand was appearing sporadically (only while hovering over the border, as you explain). Thank you! πŸ˜€
  • p

    prehistoric-soccer-76386

    02/10/2023, 8:35 AM
    Um... Hi, I think it's silly question but is there way to ajax call triggered by only custom event (not default submit)? For example
    Copy code
    html
    <form hx-post="/choco" hx-trigger="choco">
      Many Input Elements here..
      <button>The button emitting "choco" event</button>
    </form>
    The reason is that..any input element inside form submits the form whenever hitting enter.. So I want to make only choco button pressed trigger ajax call, ignoring browser default. I try add
    onsubmit="return false;"
    to form element, but it doesn't work. Thanks for reading!
  • s

    some-airline-73512

    02/10/2023, 9:12 AM
    Here. I made one click here that triggered hx-post
  • l

    little-electrician-91324

    02/10/2023, 9:23 AM
    yes it's quite likely that it's a bug. But do you think it's an OOB swap that updates the URL in
    hx-get
    ?
  • s

    some-airline-73512

    02/10/2023, 9:26 AM
    @mysterious-toddler-20573 If I remove all the inputs from the form, the hx-post goes immediately. So I'm thinking how to optimise that. The form looks like Excel spreadsheet(read-only). So every column has filters with set of values that are 'selected'. They are represented as form inputs. One thing I could go with is don't send the entire form, but send only the params that have changed and keep form persisted on the backend, but I don't know if that's a good approach. I heard Phoenix is doing something similar, need to dig deeper into what they are doing. Another way would be to try and optimize htmx's core so that it collects inputs faster. Maybe plain JS optimization would be sufficient. Maybe not and then rewrite that part in WASM, but I'm not sure that will help, maybe it's just DOM that is slow. Most of the time is spent in haveSeenNode and isSameNode. What do you think?
  • r

    ripe-action-67367

    02/10/2023, 9:28 AM
    No urls are updated. Look at the code on that page.
    hx-get
    is set on the last row, not the table itself.
    hx-trigger
    is set to revealed, which means that the request will be triggered when the user scroll down to the last row, and it will only trigger once. And
    hx-swap
    is set to
    afterend
    , which means, that next rows in the scroll will be added to the table right after the last one
  • l

    little-electrician-91324

    02/10/2023, 9:34 AM
    Ahh I get it! For some reason I was sure that the
    hx-get
    was on the table and not the tr πŸ€¦β€β™‚οΈ. Now it makes sense, clever! Thanks for your help and patience.
  • m

    millions-florist-36785

    02/10/2023, 9:45 AM
    hey guys, just heard about htmx, anyone has some good examples on python with htmx ?
  • m

    millions-florist-36785

    02/10/2023, 9:45 AM
    simples ones to understand would be really nice
  • s

    some-airline-73512

    02/10/2023, 10:10 AM
    @mysterious-toddler-20573 please take a look https://github.com/bigskysoftware/htmx/pull/1249
  • p

    prehistoric-soccer-76386

    02/10/2023, 10:27 AM
    I found the solution in past discussions. Thanks a lot! (https://discord.com/channels/725789699527933952/725789747212976259/1024365288734597143)
  • s

    some-airline-73512

    02/10/2023, 11:25 AM
    @mysterious-toddler-20573 another problem I found, swap takes 870ms + settle another 487ms. Profile: https://gist.github.com/alexbezhan/6f08138f5614dcf4fbf34665e57eb43c
  • o

    orange-umbrella-16693

    02/10/2023, 1:07 PM
    Why are there so many triggerEvent() calls in this
  • a

    adventurous-ocean-93733

    02/10/2023, 1:08 PM
    #941388608290574336 and #864934037381971988 channels are a good place to ask for specific examples for your use case. Also check out: https://htmx.org/server-examples/ This is the contacts app explained in the Hypermedia Systems book: https://github.com/bigskysoftware/contact-app If you haven’t read the book, I would highly recommend it, even cherry picking some sections: https://hypermedia.systems/book/contents/
  • m

    millions-florist-36785

    02/10/2023, 2:46 PM
    Cheers, I will take a look
  • d

    dazzling-shoe-67340

    02/10/2023, 3:36 PM
    I'm using hx-boost, however it seems it does not update the css body classes that's present on the new page being loaded; i even tried forcing outerHTML like this: hx-boost="true" hx-swap="outerHTML" , in addition to using the head support extension but no luck; any ideas why?
  • d

    dazzling-shoe-67340

    02/10/2023, 3:46 PM
    ok well this explains why at least: https://github.com/bigskysoftware/htmx/issues/790 ; is there a way to force it to use the updated classes however?
  • m

    mysterious-toddler-20573

    02/10/2023, 4:02 PM
    cleanUpElement event issue, known problem
  • s

    some-airline-73512

    02/10/2023, 5:10 PM
    Yes, I commented that out (recursive part of it). Should I expect it to blow up some day or it's fine?
  • m

    mysterious-toddler-20573

    02/10/2023, 5:23 PM
    it is needed for the web socket/sse extensions, but I want to rework that
  • s

    some-airline-73512

    02/10/2023, 5:26 PM
    Okay, so if I don't use those, I'm good I guess
  • l

    limited-teacher-83117

    02/10/2023, 6:15 PM
    This was explained to me here: https://github.com/bigskysoftware/htmx/issues/1130#issuecomment-1374184015 The behavior was a little strange to me at first but I've come to appreciate it that it's useful to have a "do nothing" response (vs 200 "here's some new stuff).
  • l

    limited-teacher-83117

    02/10/2023, 6:19 PM
    I've got a small question: I would like a button that submits a form to change to indicate that the request was successful, and then revert back to its original state. The first part is easy (just have the response return a new button), the reverting to its original state has me stuck. I can think of some convoluted ways with client-side JS, but I'd like to avoid that if possible
  • m

    mysterious-toddler-20573

    02/10/2023, 6:31 PM
    hyperscript is probably the best option I can offer unfortunately
  • m

    mysterious-toddler-20573

    02/10/2023, 6:32 PM
    actually, you could return the button content w/ something like:
    Copy code
    hx-trigger="load delay:2s" hx-get="/reset_button"
  • d

    dazzling-shoe-67340

    02/10/2023, 8:06 PM
    @mysterious-toddler-20573 can hx-boost replace the class names on the body element?
  • m

    mysterious-toddler-20573

    02/10/2023, 8:16 PM
    not currently unfortunately
  • m

    mysterious-toddler-20573

    02/10/2023, 8:16 PM
    in htmx 2.0, morph swapping should allow this
  • d

    dazzling-shoe-67340

    02/10/2023, 8:17 PM
    ok. i suppose i can just add my classes to a wrapping div. no big deal
1...101510161017...1146Latest