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

    mysterious-toddler-20573

    08/23/2022, 12:00 AM
    You want to set
    htmx.config.useTemplateFragments
    to `true`: https://htmx.org/docs/#config
  • m

    mysterious-toddler-20573

    08/23/2022, 12:01 AM
    that should make table rows parse correctly
  • m

    mysterious-toddler-20573

    08/23/2022, 12:01 AM
    https://twitter.com/htmx_org/status/1561865480419393536
  • m

    mysterious-toddler-20573

    08/23/2022, 12:01 AM
    I am of sound mind and look forward to a productive next decade of web development
  • m

    mysterious-toddler-20573

    08/23/2022, 12:06 AM
    JATEOAS
  • i

    incalculable-scientist-18707

    08/23/2022, 12:55 AM
    I had already set htmx.config.useTemplateFragments to true, but that didn't seem to work. Is there a good way to confirm this is set correctly in the browser?
  • m

    mysterious-toddler-20573

    08/23/2022, 1:36 AM
    can you debug htmx?
  • e

    echoing-nest-31408

    08/23/2022, 1:59 AM
    Oh perfect, it wasn't obvious to me from the docs that I needed to include that. That looks like it might be working, and working better! I'll do some more testing. The only oddity was that hx-swap="morphdom" seems to replace outer html instead of the default inner html.
  • i

    incalculable-holiday-29658

    08/23/2022, 2:31 AM
    is there a implementation of select2 in htmx?
  • e

    echoing-nest-31408

    08/23/2022, 2:34 AM
    I've noticed with hx-trigger="input delay:1s", if I make a change and then hit tab to go to a button, then the button's submit action gets sent when the 1s delay is up. So, for example, I might make a change to an input field, then on my way to tabbing to a new field I tab past a 'delete' button, and it submit's that button's value with the POST request resulting in an unintended delete.
  • e

    echoing-nest-31408

    08/23/2022, 2:59 AM
    Also, on safari only I think, if I click a button with a submit value, and then change an input, then the "input delay:1s" on the element sends the submit value for that last pressed button
  • i

    incalculable-holiday-29658

    08/23/2022, 3:13 AM
    try the changed in the hx-trigger
  • i

    incalculable-holiday-29658

    08/23/2022, 3:13 AM
    here's a good explanation https://htmx.org/examples/active-search/
  • e

    echoing-nest-31408

    08/23/2022, 3:19 AM
    I'm putting 'changed delay:1s' in the element, but it doesn't seem to trigger any requests when I do that. Not sure if changed needs to be on the same element.
  • e

    echoing-nest-31408

    08/23/2022, 3:22 AM
    I could probably work around my issue if there was a way on the server that I could tell which trigger in hx-trigger was sending the request. So for example, if I have: hx-trigger="input delay:1s, submit" and the request told me if it was the "input delay:1s" or the "submit" that caused the event, that may work. If it's submit, then I look at submit value. If it's the input delay:1s, then I ignore the submit value (just do the default action).
  • e

    echoing-nest-31408

    08/23/2022, 3:23 AM
    I can't see a way to distinguish triggers though.
  • m

    mysterious-toddler-20573

    08/23/2022, 3:27 AM
    I'm sorry, can you remind me what we are doing here?
  • m

    mysterious-toddler-20573

    08/23/2022, 3:27 AM
    typically you wouldn't want to have a delay combined with a submit in this way, it would lead to strange behavior
  • e

    echoing-nest-31408

    08/23/2022, 3:29 AM
    @mysterious-toddler-20573 this is something new since we last talked. I found an issue where a request being triggered by input delay:1s was sending the button's submit value if I tabbed to that button when the 1s timer was up. Workaround: remove buttons from tabindex. But I notice on safari it's sending the button's submit value in other cases too.
  • m

    mysterious-toddler-20573

    08/23/2022, 3:30 AM
    Yeah, the input event is triggered when input is entered, which for a submit "input" is when you click it. This seems like it isn't what you want.
  • m

    mysterious-toddler-20573

    08/23/2022, 3:30 AM
    What are you trying to achieve?
  • m

    mysterious-toddler-20573

    08/23/2022, 3:30 AM
    In broad terms?
  • m

    mysterious-toddler-20573

    08/23/2022, 3:30 AM
    Why have any delay at all?
  • e

    echoing-nest-31408

    08/23/2022, 3:32 AM
    Mostly just because it might clobber the server because it does some calculations with each request. It might not actually be an issue.
  • e

    echoing-nest-31408

    08/23/2022, 3:33 AM
    In broad terms, I have a form that takes an input and returns some results. Part of that form includes buttons to add or remove elements (family members), as well as inputs to enter things like income, dependent children ages.
  • e

    echoing-nest-31408

    08/23/2022, 3:33 AM
    Trying to get a smooth experience so that as the form is updated, the results are displayed shortly after without needing to click submit. Not sure if that's how broad you meant 🙂
  • m

    mysterious-toddler-20573

    08/23/2022, 3:34 AM
    Right, OK. So you want to submit the form even if the user doesn't explicitly submit it, when things are "at rest"
  • m

    mysterious-toddler-20573

    08/23/2022, 3:35 AM
    But also when they submit the form, normally.
  • e

    echoing-nest-31408

    08/23/2022, 3:35 AM
    Yep that's it
  • m

    mysterious-toddler-20573

    08/23/2022, 3:35 AM
    Roger. OK
1...792793794...1146Latest