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

    ancient-father-3063

    07/25/2022, 2:25 PM
    so whereever is easiest
  • a

    ancient-father-3063

    07/25/2022, 2:30 PM
    I see this in the docs:
  • a

    ancient-father-3063

    07/25/2022, 2:30 PM
    "By default, an element that causes a request will include its value if it has one. If the element is a form it will include the values of all inputs within it."
  • a

    ancient-father-3063

    07/25/2022, 2:31 PM
    but my button does not seem to be doing that.
  • a

    ancient-father-3063

    07/25/2022, 2:31 PM
    When I print the request.GET I just get an empty dictionary
  • s

    stocky-dentist-80693

    07/25/2022, 2:39 PM
    What if you add a
    name='mybutton'
    attribute to the button tag?
  • a

    ancient-father-3063

    07/25/2022, 2:41 PM
    😦 , no, no change
  • m

    mysterious-toddler-20573

    07/25/2022, 3:13 PM
    🤔
  • m

    mysterious-toddler-20573

    07/25/2022, 3:18 PM
    https://codepen.io/1cg/pen/QWmMaad?editors=1000
  • m

    mysterious-toddler-20573

    07/25/2022, 3:18 PM
    maybe for now hx-vals can work?
  • m

    mysterious-toddler-20573

    07/25/2022, 4:23 PM
    airhacks.fm interview: https://open.spotify.com/show/6nOTQLa2uZxeyGpMW8eppS
  • t

    thankful-sugar-81945

    07/25/2022, 7:54 PM
    Hey folks! I was looking for an example of authenticated requests with htmx. Like a dashboard that requires a user to be logged in and show conditional info based on the roles. If isn't there, what's a good way to approach this?
  • b

    bitter-monkey-50309

    07/25/2022, 8:12 PM
    You'd approach it in the exact same way you would for a normal server side rendered app, but if you need to perform ajax requests like updating small parts of a page after it's loaded you can use htmx
  • m

    mysterious-toddler-20573

    07/25/2022, 8:16 PM
    Yep, typically you'd use the "normal" authentication module for your server side framework, and that would establish a "session" cookie that is passed along w/ every request (either htmx driven or otherwise). The authentication module typically has a notion of "the current user" that you can consult when determining what to render in the HTML, or if a given action is allowed, etc.
  • t

    thankful-sugar-81945

    07/25/2022, 8:18 PM
    Nice. I'll play around with this and see what I can get done.
  • a

    ancient-father-3063

    07/25/2022, 11:52 PM
    I am using django so I understand what the crsf token is about, but I didn't think I needed it here? I guess I don't understand why this is different.
  • h

    hundreds-camera-24900

    07/25/2022, 11:52 PM
    yeah csrf not used on gets
  • h

    hundreds-camera-24900

    07/25/2022, 11:53 PM
    wierd bug - I'm developing, decide I don't actually want to use the history cache, set the cache size to 0, DONT delete the local storage, htmx continue to use the cached response and never changes it
  • h

    hundreds-camera-24900

    07/25/2022, 11:53 PM
    have to manually delete the local storage to get it working
  • a

    ancient-father-3063

    07/25/2022, 11:53 PM
    I have used this function before, but I always had it trigger from 'change, load', and it was always from a form field.
  • a

    ancient-father-3063

    07/25/2022, 11:53 PM
    that works fine
  • a

    ancient-father-3063

    07/25/2022, 11:53 PM
    now I'm just trying to do the same thing from a button click
  • a

    ancient-father-3063

    07/25/2022, 11:58 PM
    Copy code
    html
    <button type="button" class="btn btn-info" id="namebutton" name="checkbutton" value="xxx" hx-trigger="click" hx-post="/checkopponent">
  • h

    hundreds-camera-24900

    07/26/2022, 12:16 AM
    if I have a button with hx-indicator on it, server response comes back and is a hx-location/hx-redirect it will pull off the loading state even though a request is still happening
  • h

    hundreds-camera-24900

    07/26/2022, 12:16 AM
    since it's a different request
  • a

    ancient-father-3063

    07/26/2022, 1:35 AM
    oh, I changed the button to input and now it's working
  • l

    late-king-98305

    07/26/2022, 1:44 PM
    I recently experienced another cool htmx side-effect. My user management page had a list of users, and I used htmx for the "Add" button to put a new row at the top of the table, and to do inline edits. As I'm building out the admin area, I decided to put the user maintenance portion on a different page (trying to reduce the number of menu items). None of my IDs conflicted, and all my targets and such worked as well. If I hadn't changed the URLs on the back end, it would have been a literal "cut/paste and it still works" scenario. Very, very cool!
  • m

    mysterious-toddler-20573

    07/26/2022, 7:10 PM
    awesome: I remember a setting page we had where we had a "card" for every integration in our system. Every time you wanted to add a new one, you could just dup an existing one, rename a few routes and blam, you were good to go. Really nice aspect
  • h

    handsome-gpu-11538

    07/27/2022, 4:23 AM
    I'm having a weird htmx issue that I hope someone can help me understand...
  • h

    handsome-gpu-11538

    07/27/2022, 4:24 AM
    In my django app, i'm using htmx to allow people to edit many scheduled events that display on a page, with each event being its own div that typically is getting cleanly replaced.
1...763764765...1146Latest