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

    mysterious-toddler-20573

    08/26/2020, 9:02 PM
    :/
  • g

    great-vase-24934

    08/26/2020, 9:25 PM
    where would the error be coming from ? that's where i'm lost
  • m

    mysterious-toddler-20573

    08/27/2020, 12:15 AM
    It looks like an “error” event coming in from the sse server but I can’t tell for sure.
  • s

    stale-whale-50398

    08/27/2020, 2:54 PM
    Is it possible to set multiple targets for a response or trigger a function instead?
  • m

    mysterious-toddler-20573

    08/27/2020, 3:44 PM
    @User https://htmx.org/docs#oob_swaps and you might want to look at the HX-Trigger response header https://htmx.org/headers/x-hx-trigger/
  • s

    stale-whale-50398

    08/27/2020, 3:49 PM
    Is there an example of oob swaps anywhere because I'm struggling to understand it
  • s

    stale-whale-50398

    08/27/2020, 3:52 PM
    The htmx trigger response header is exactly what I need, this library is really amazing.
  • s

    stale-whale-50398

    08/27/2020, 4:08 PM
    After rereading oob I think it sank in, just include the element you want changed and add`hx-swap-oob="true"` in addition to whatever you're doing normally and both will be swapped.
  • m

    mysterious-toddler-20573

    08/27/2020, 4:33 PM
    yep
  • m

    mysterious-toddler-20573

    08/27/2020, 4:33 PM
    oob swaps are done by ID
  • m

    mysterious-toddler-20573

    08/27/2020, 4:33 PM
    so you have to know the ID of the out of band element you want swapped
  • m

    mysterious-toddler-20573

    08/27/2020, 4:33 PM
    and it has to be at the top level
  • m

    mysterious-toddler-20573

    08/27/2020, 4:34 PM
    glad you are enjoying it 🙂
  • h

    hallowed-bird-48637

    08/29/2020, 1:16 PM
    Hello everyone! is it possible using prefetch with htmx? https://web.dev/link-prefetch/#prefetching-subsequent-pages
  • m

    mysterious-toddler-20573

    08/29/2020, 1:41 PM
    I would imagine it should work, htmx requests are just HTTP requests, nothing magic, so prefetching them should cache them locally just like any other resource
  • d

    damp-river-86254

    08/30/2020, 2:30 AM
    Hi everyone, is there a way to clear an input field after an hx-post? I have a button that sends the data in the input and I would like it to clear out the input on success.
  • m

    mysterious-toddler-20573

    08/30/2020, 3:22 AM
    Typically I would say replace both the input and the button
  • m

    mysterious-toddler-20573

    08/30/2020, 3:22 AM
    By targeting an element enclosing both (eg a form)
  • m

    mysterious-toddler-20573

    08/30/2020, 3:23 AM
    If that’s not possible or what you want, you could use an out of band swap for the input
  • d

    damp-river-86254

    08/30/2020, 3:24 AM
    ok, thank you
  • m

    mysterious-toddler-20573

    08/30/2020, 3:24 AM
    https://htmx.org/docs#oob_swaps
  • b

    big-airline-13935

    08/30/2020, 7:43 AM
    I've successfully added hyperscript to my htmx components to allow them to trigger each others' refresh events and it works (and reads) really well. Looking forward to some more momentum on this project!! https://putyourlightson.com/sprig-cookbook#refreshing-components
    Copy code
    _="on htmx:afterSwap send refresh to #counter"
  • m

    mysterious-toddler-20573

    08/30/2020, 1:59 PM
    That is awesome Ben! That's exactly the sort of use case I envisioned for hyperscript: the equivalent javascript couldn't be written inline (except with something like AlpineJS) and would be a lot less readable:
    Copy code
    js
    document.addEventListener("htmx:afterSwap"), function(event){
      document.getElementById("counter").dispatchEvent(new CustomEvent("refresh"));
    }
  • m

    mysterious-toddler-20573

    08/30/2020, 2:01 PM
    I am getting my home office back this week and should be able to start putting in work on both htmx and hyperscript soon. With AlpineJS supporting camelcase event names now, I think we may have an alpha release of htmx 1.0 at the end of September 👍
  • m

    mysterious-toddler-20573

    08/30/2020, 2:02 PM
    also, saying this outloud to help my own thinking: hyperscript is designed to be easy to read, so that someone can look at it and intuitively understand what is happening quickly
  • m

    mysterious-toddler-20573

    08/30/2020, 2:04 PM
    to do that I have added some high level language statements such as
    send
    , etc. that help avoid all the extra code required in javascript. This means that I need to focus the language on a specific domain or it will get completely our of control. So my focus is going to be on front end glue code: stuff you should ideally be able to embed directly in HTML
  • m

    mysterious-toddler-20573

    08/30/2020, 2:10 PM
    @User can I put together a tweet about this?
  • b

    big-airline-13935

    08/30/2020, 2:12 PM
    @User Sure!
  • m

    mysterious-toddler-20573

    08/30/2020, 2:23 PM
    https://twitter.com/htmx_org/status/1300075579631374346
  • g

    gorgeous-ghost-95789

    08/31/2020, 2:23 AM
    Very Cool. The side-by-side comparison of the two sets of code really makes a clear case! Keep going like this, and you're going to force me to include Hyperscript in my next set of code 🙂
1...192021...1146Latest