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

    ripe-action-67367

    04/18/2023, 1:17 PM
    what was the intended purpose of
    click;
    ?
  • r

    ripe-action-67367

    04/18/2023, 1:17 PM
    to tell htmx that the request should be triggered by a click, correct?
  • s

    shy-knife-59740

    04/18/2023, 1:18 PM
    yes, thats why i was asking that question earlier if its nescessary
  • r

    ripe-action-67367

    04/18/2023, 1:18 PM
    that's what
    hx-trigger
    is for
  • r

    ripe-action-67367

    04/18/2023, 1:18 PM
    so you would have
    hx-trigger="click" hx-on="htmx:afterRequest: window.location.reload()"
  • r

    ripe-action-67367

    04/18/2023, 1:19 PM
    and since element is a button, htmx will use
    click
    by default, so hx-trigger can be ommited
  • s

    shy-knife-59740

    04/18/2023, 1:20 PM
    wanted to ask about that but i figured it would chose it by default
  • s

    shy-knife-59740

    04/18/2023, 1:20 PM
    thanks a lot
  • r

    ripe-action-67367

    04/18/2023, 1:20 PM
    yes, htmx tries to use "natural" events for each element by default. Click for buttons, submit for forms and so on
  • r

    ripe-action-67367

    04/18/2023, 1:21 PM
    you are very welcome!
  • a

    abundant-spring-38265

    04/18/2023, 1:57 PM
    Hey guys, do you know if mustache-template has issue of accessing JSON response with key named "data"? { "messages": [], "see_also": [], "version": "0.3", "data_call_name": "as-names", "data_call_status": "supported - Flow based", "cached": false, "data": { "names": { "1": "LVLT-1" }, "resources": [ "1" ] }, "query_id": "20230418131631-8e6d823a-8973-453a-8e26-0544fb9e770e", "process_time": 26, "server_id": "app128", "build_version": "live.2023.4.18.148", "status": "ok", "status_code": 200, "time": "2023-04-18T13:16:31.688632" }
  • a

    abundant-spring-38265

    04/18/2023, 1:57 PM
    i'm looking at parsing {{ data.names }}
  • m

    mysterious-toddler-20573

    04/18/2023, 4:10 PM
    i seem to remember that being an issue
  • a

    aloof-painter-18008

    04/18/2023, 5:13 PM
    Any luck?
  • a

    aloof-painter-18008

    04/18/2023, 5:15 PM
    I'm using Vite, so any upgrade from 1.8.5 is breaking the app because it throws htmx is not defined. Until now, I import htmx.org and get the htmx object from the window, but it is not working anymore from 1.8.6
  • m

    microscopic-cartoon-64495

    04/18/2023, 5:34 PM
    Unfortunately no. Solution provided by @stocky-dentist-80693 doesn't work for me.
  • r

    refined-waiter-90422

    04/18/2023, 5:37 PM
    I wouldn't lose tons of sleep over it not being in your bundlers. htmx is just 1 file, compresses very well by default on most web servers, and barely a blip on your page load to begin with.
  • r

    refined-waiter-90422

    04/18/2023, 5:48 PM
    bundling makes more sense with libraries that are made up of tens or hundreds of modules which would require an http request each-- htmx doesn't suffer from that.
  • m

    mysterious-toddler-20573

    04/18/2023, 6:23 PM
    i wonder if this broke it: https://github.com/bigskysoftware/htmx/commit/a85ad4ac67c3a471dbb8472900ec1e583b571a67
  • m

    mysterious-toddler-20573

    04/18/2023, 6:23 PM
    I don't understand that stuff at all, I have to admit
  • s

    shy-knife-59740

    04/18/2023, 10:14 PM
    hey where can we find the logos for "htmx related" products?
  • s

    shy-knife-59740

    04/18/2023, 10:14 PM
    and the copyrights for them?
  • m

    magnificent-boots-1658

    04/18/2023, 11:22 PM
    Hi gang! I can't seem to find documentation to help me down this path: I am loading some content (in an
    oob
    swap, for what it's worth) and really want an
    <input>
    in that content to become focused once it's swapped in. Is that possible with naked HTMX, or do I need to look into.. gasp.. writing some JavaScript?
  • m

    magnificent-boots-1658

    04/18/2023, 11:36 PM
    I tried using an
    hx-on
    but it would appear that
    htmx:afterSettle
    is fired before any listeners are wired from
    hx-on
    for new content. Or some other sort of race.
  • m

    magnificent-boots-1658

    04/18/2023, 11:39 PM
    I can attach a
    htmx:afterSettle
    to my whole-ass
    body
    to find the field and focus it, but there's two drawbacks there: 1. I have to write JS 2. I have to deal with detaching the listener after it happens once, pretty much, which is a pain. I could also throw it in a
    setTimeout
    and hopefully not hit a race condition, but that'd just be a matter of luck.
  • m

    magnificent-boots-1658

    04/18/2023, 11:40 PM
    Oh duh it's OOb maybe I need oobAfterSwap
  • m

    magnificent-boots-1658

    04/18/2023, 11:42 PM
    Nope, that didn't do it at least not in
    hx-on
  • m

    magnificent-boots-1658

    04/19/2023, 12:05 AM
    Welp, I'm just being lazy and setting a listener on
    htmx:afterSettle
    on
    body
    and just using a
    dataset
    value on the element to ensure I only focus it once.
  • m

    magnificent-boots-1658

    04/19/2023, 12:05 AM
    Interested in other ideas if anyone has them tho!
  • g

    gray-morning-3453

    04/19/2023, 4:53 AM
    What's the right way to make HTMX served buttons call the existing event handlers on the page?
1...109710981099...1146Latest