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

    future-table-82610

    11/29/2022, 7:37 PM
    Hey all, I'm trying to debug something and am having some trouble. I have a script that updates a value on the server via a self submitting input. Previously, when submitted the server would return an okay but the value wouldn't be changed (empty response), now, when the server responds it deletes the local element. I figure something changed with a
    swap
    setting, but I can't figure out where since the element itself hasn't changed. I've turned on debugging, but I can't figure out where to see the various htmx settings that would impact an element. Any tips?
  • f

    future-table-82610

    11/29/2022, 7:39 PM
    Also, as a general aside, I discovered that
    hx-validate
    doesn't seem to work when the element is submitted via a button click and the
    input
    elements are included via
    hx-include
    . Maybe that's a strange edge case, but it threw me so figured I'd raise it.
  • f

    future-table-82610

    11/29/2022, 7:40 PM
    This presentation was interesting having sat through it, they seem to do a lot of things via triggered client side events which is neat. I took a couple of tips from that, but it would be amazing to see how docs/write ups with suggestions on sttructing htmx/django apps using client side events and how that can be done cleanly. They are doing some neat things though.
  • a

    abundant-spring-38265

    11/29/2022, 7:58 PM
    I need a way for htmx to get the values of the drop-down to then get or post, is that possible?
  • a

    abundant-spring-38265

    11/29/2022, 7:59 PM
    How would htmx get the drop-down values?
  • g

    green-activity-6102

    11/29/2022, 8:02 PM
    HTMX passes HTML over the wire, not JSON. So you should have HTMX return the entire markup for the entire dropdown with the options populated, or the entire form depending on what you’re doing
  • m

    mysterious-toddler-20573

    11/29/2022, 8:53 PM
    a few different ways: if you are doing a non-GET within a form, all inputs in the form should automatically be included. In your case, since you are doing a GET, you'll need to use
    hx-include='closest form'
    and the values should be included in the request
  • a

    abundant-spring-38265

    11/29/2022, 9:18 PM
    Hmm, my button is outside of the for loops. So i can't use them variables.πŸ˜‘
  • e

    early-camera-41285

    11/29/2022, 9:29 PM
    Okay, so I finally need to swap a
    <tr/>
    and am seeing that the HTMX attributes are not initialized. I think I remember seeing a lot of chatting about this issue. Is this what idiomorph is for? How are we swapping pieces of HTML tables these days?
  • e

    early-camera-41285

    11/29/2022, 9:34 PM
    The swap is working fine, btw; I just don't get HTMX initialization
  • m

    mysterious-toddler-20573

    11/29/2022, 9:34 PM
    A
    tr
    should work, but it won't play nicely with other content in the response (e.g. oob) unless you turn template parsing on: https://htmx.org/docs/#config
    htmx.config.useTemplateFragments
    set to
    true
    (nukes IE compatibility tho)
  • m

    mysterious-toddler-20573

    11/29/2022, 9:34 PM
    is there a way to use a CSS selector to include the form?
  • c

    clever-activity-24633

    11/29/2022, 9:46 PM
    Is there an example Scala-based HOWL stack?
  • m

    mysterious-toddler-20573

    11/29/2022, 9:48 PM
    not that I'm aware of, but it shouldn't be dramatically different than any other platform
  • g

    great-lifeguard-29000

    11/30/2022, 12:55 AM
    Hi all, I'm trying to generate a ws event with ws-send. I can do this easily enough with this fragment:
    Copy code
    <div><p id="notifications"></p>
        <form method="post" name="chat_message" ws-send="true"><input
                autocomplete="off" name="chat_message"/></form>
    </div>
    When this form is submitted, I get websocket event on the server with the attribute and value of "chat_message": "the value of the form field" along with a "HEADERS" key with the normal HX-* values. What I am trying to do is generate a ws event by clicking on an
    <a>
    tag, like so:
    Copy code
    <a href="#" method="post" name="change_room" value="Room"
       ws-send="true">Room</a>
    When I do this, I get a map with just "HEADERS" and no other entries. I'm trying to get something along the lines of "change_room": "Room" (the name: value pair). Any ideas on how to do this?
  • g

    great-lifeguard-29000

    11/30/2022, 12:57 AM
    BTW, I'm totally new to htmx and wanted to say "Hi" to the community. I've been using it for about a week and really, really like it so far.
  • b

    boundless-leather-51644

    11/30/2022, 9:03 AM
    Hi
  • r

    ripe-action-67367

    11/30/2022, 11:44 AM
    use hx-vals attribute https://htmx.org/attributes/hx-vals/ to attach data to requests coming from non-forms
  • b

    boundless-vase-80440

    11/30/2022, 12:28 PM
    welcome! What attracted you in htmx?
  • s

    salmon-oil-67352

    11/30/2022, 1:58 PM
    Does anybody have that meme where it says "they poison us with React, and try to sell us the cure GraphQL, but the solution in HTMX" or something like that?
  • t

    tall-dinner-62086

    11/30/2022, 2:06 PM
    That was the wrong one
  • t

    tall-dinner-62086

    11/30/2022, 2:07 PM
    https://discord.com/channels/725789699527933952/996832027083026563/1042493294283862086
  • h

    hundreds-cartoon-20446

    11/30/2022, 6:05 PM
    The solution is to use a
    <div>
    placeholder for the video and
    appendChild()
    a
    <video>
    inside it. My comment on that issue gives you an idea of how to go about that.
  • h

    hundreds-cartoon-20446

    11/30/2022, 6:06 PM
    (It's not really something that can be addressed in htmx itself, being a limitation of Safari when cloning web components)
  • m

    mysterious-toddler-20573

    11/30/2022, 7:40 PM
    need to create a more elaborate example of this: poor mans server-side autocomplete using a datalist element https://codepen.io/1cg/pen/qBKMQqd?editors=1000
  • m

    mysterious-toddler-20573

    11/30/2022, 7:41 PM
    of course, doesn't work on safari πŸ˜‘
  • m

    mysterious-toddler-20573

    11/30/2022, 7:41 PM
    this is why we can't have nice things
  • m

    miniature-lizard-24702

    11/30/2022, 8:07 PM
    aww, that looks cool too
  • b

    boundless-vase-80440

    11/30/2022, 8:24 PM
    datalist , template...
  • a

    ancient-shoe-86801

    11/30/2022, 9:04 PM
    oh, I did one of these for an app
1...926927928...1146Latest