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

    mysterious-toddler-20573

    09/27/2022, 2:16 AM
    but you have my thoughts and prayers
  • h

    hundreds-camera-24900

    09/27/2022, 2:16 AM
    🙏
  • p

    proud-librarian-99598

    09/27/2022, 8:12 AM
    I have a page with a table with rows. Each row has a button to show more info in an off-canvas and there is a filter select at the top of the table. Both the filter and the buttons are powered by htmx. I now want to add error and timeout handling for both. I am wondering what the best way is (or if it does not matter). I could do
    document.addEventListener(...)
    and somehow use something from the event to know if it is a request coming from the filter or for the off-canvas (because the way I will display errors is different). Or is it better to add the event listener to each of the action buttons of the table rows, and to the filter select all separately. So I already know what request is failing? I am just wondering if adding many event listeners would have a negative impact on performance?
  • p

    proud-librarian-99598

    09/27/2022, 8:32 AM
    Is it possible to define 2 triggers on an element (a
    <tr>
    in my case) where each trigger does a different request and also does a different swap? My use case is combining an infinite scroll (so trigger
    intersection once
    with swap
    afterend
    ) with polling to update a row itself (so trigger
    every 1 s
    with swap
    outerHTML
    ).
  • b

    boundless-rocket-26534

    09/27/2022, 9:43 AM
    Is there a recommended way to build components for htmx? Or libraries one can use?
  • f

    future-table-82610

    09/27/2022, 1:54 PM
    Yes, the elements have ID, so the
    preserve
    works great from that aspect, but the element (if a marked with preserve) just loses focus. Quite frustrating for users, but also makes it difficult to use
    preserve
    if it's updating while a user might be updating a text input field.
  • g

    great-manchester-46916

    09/27/2022, 4:05 PM
    has anyone had issues with the halt in hyperscript not stopping events bubbling? I have an input element that I want the keyup Enter to click an adjacent button and not submit the form but happy for any other input field to submit on enter being pressed
  • m

    mysterious-toddler-20573

    09/27/2022, 4:15 PM
    https://github.com/bigskysoftware/_hyperscript/blob/master/src/_hyperscript.js#L4983
  • m

    mysterious-toddler-20573

    09/27/2022, 4:15 PM
    that's where we stop bubbling
  • m

    mysterious-toddler-20573

    09/27/2022, 4:16 PM
    depending on what you mean, normal web components should work OK w/ htmx. Or, if you are asking how to structure your server side code, it's going to depend on what your server side gives you.
  • m

    mysterious-toddler-20573

    09/27/2022, 4:17 PM
    typically I would recommend two different elements for the two behaviors (potentially one element with no impace on the layout, such as a div wrapped around another div)
  • g

    great-manchester-46916

    09/27/2022, 4:20 PM
    Thanks - is it not possible to stop this behaviour or do I have the syntax wrong? I've tried halt bubble and default and just halt but the form is always submitted. Pretty sure I've had it working with preventDefault in js before.
  • m

    mysterious-toddler-20573

    09/27/2022, 4:25 PM
    are you able to use the uncompressed version of hyperscript and set a break point?
  • m

    mysterious-toddler-20573

    09/27/2022, 4:25 PM
    which event are you halting?
  • g

    great-manchester-46916

    09/27/2022, 4:41 PM
    Thanks, I'll try the uncompressed version. It's keyup == "Enter" on an input field. I can log the event and halt an alert with hyperscript but the input type="submit" is always triggered. I have _="on htmx:beforeSend set #submitButton.disabled to 'disabled'" on the form which I'll try removing
  • m

    mysterious-toddler-20573

    09/27/2022, 5:01 PM
    ah, you are going to have to cancel the "submit" event on the form
  • m

    mysterious-toddler-20573

    09/27/2022, 5:01 PM
    those are going to be separate unfortunately
  • m

    mysterious-toddler-20573

    09/27/2022, 5:01 PM
    i believe
  • m

    mysterious-toddler-20573

    09/27/2022, 5:01 PM
    https://stackoverflow.com/questions/895171/prevent-users-from-submitting-a-form-by-hitting-enter
  • m

    mysterious-toddler-20573

    09/27/2022, 5:02 PM
    or maybe the "keydown" event?
  • g

    great-manchester-46916

    09/27/2022, 5:12 PM
    I've changed the type to button instead of submit and wired that up to a submit on the click for now.
  • a

    ancient-shoe-86801

    09/27/2022, 6:03 PM
    today I heard a new one: "HTMX is a technology trying to do too much". I'm trying to engage with the user to understand where is he coming from. I wonder if he is mixing htmx with hyperscript.
  • m

    mysterious-toddler-20573

    09/27/2022, 6:17 PM
    lol
  • m

    mysterious-toddler-20573

    09/27/2022, 6:37 PM
    "htmx isn't focused enough"
  • m

    mysterious-toddler-20573

    09/27/2022, 6:37 PM
    "htmx is too hard to install"
  • f

    freezing-waitress-26396

    09/27/2022, 6:43 PM
    lmao
  • f

    freezing-waitress-26396

    09/27/2022, 6:43 PM
    I like how people immediately assume htmx is supposed to replace [technology].
  • c

    cuddly-keyboard-70746

    09/28/2022, 1:33 AM
    a bunch of html attributes to avoid writting js vs webpack + a whole bunch of js libraries and transitive deps
  • c

    cuddly-keyboard-70746

    09/28/2022, 1:33 AM
    definitely trying to do too much
  • c

    cuddly-keyboard-70746

    09/28/2022, 1:34 AM
    to be fair with abito you don't have to renounce to anything to use htmx, but man there is a beauty about leaving behind a lot of the modern stack complexity and rely more on backend and hypermedia
1...838839840...1146Latest