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

    powerful-army-90860

    06/29/2022, 5:03 AM
    I'm having some issues getting loading states to work. This is my body tag:
  • p

    powerful-army-90860

    06/29/2022, 5:03 AM
    And the form which is displayed in a modal (I've also tested adding the extension to the form tag)
  • p

    powerful-army-90860

    06/29/2022, 5:04 AM
    The "Confirm" button is not disabled on submission
  • p

    powerful-army-90860

    06/29/2022, 5:05 AM
    I can't see what is wrong here
  • r

    refined-quill-15894

    06/29/2022, 5:15 AM
    Hey everyone.. First post here.. I was after some best practice advice for pushing URLs on post/put/delete.. is it generally preferred to do them in the markup with
    "hx-push-url"
    or on the server with a
    "HX-Push"
    header? TIA
  • c

    calm-ice-23682

    06/29/2022, 7:49 AM
    Maybe you are right and it is only an issue when it relates to accepting user generated input. Javascript isn't my strength and I don't know the answers, but I definitely need this community to advise me (and other newer front-end devs) on what the best security practices are for this new tech. After initial load of extensions, are any additional extensions that are loaded into the browser later (by whatever means) automatically accepted by htmx? what if an extension is compromised or malicious? what are the consequences? these are all just questions which I think should be considered at some point. I guess what I mean is that "boundary" doesn't necessarily just mean performing ajax calls. Or maybe it does and that is the line htmx wishes to draw (which is fine). Just as long as everyone is on the same page that if you or your clients want any security beyond that then you have to take those steps yourself or just ensure you are following all those other security best-practices suggested above.
  • t

    tall-dinner-62086

    06/29/2022, 8:35 AM
    There's no such thing as security on the client-side. Once you send your html/javascript/etc, the client is free to do with it as they please. Extensions won't just load themselves, either you send them, and that's your problem, or something else on the client loads them, and that's not your problem.
  • b

    blue-ghost-19146

    06/29/2022, 10:14 AM
    Does hx-vals=“unset” work? It’s throwing a syntax error. ‘{“unset”: “true”}’ or similar prevents the error but doesn’t actually unset the inherited vals
  • m

    mysterious-toddler-20573

    06/29/2022, 1:04 PM
    @most-jelly-15242 👆
  • m

    mysterious-toddler-20573

    06/29/2022, 1:05 PM
    looks like a bug, you can use
    hx-params
    to filter everything out
  • a

    abundant-spring-38265

    06/29/2022, 1:37 PM
    hey guys, i've raised a Q on twitter on the placement of hx-ext="client-side-templates", my HTML: Current Running Task Progress <div hx-get="/tasks/{{ data.job.id }}" hx-trigger="every 1s" hx-target="#task_output" nunjucks-template="job_rq_template"> {{ items }}
  • a

    abundant-spring-38265

    06/29/2022, 1:39 PM
    i'm monitoring RQ worker job process (polling every min) the response is in JSON and i'd like to parse it using the template
  • m

    mysterious-toddler-20573

    06/29/2022, 1:39 PM
    any error messages?
  • m

    mysterious-toddler-20573

    06/29/2022, 1:39 PM
    The extension is really simple, so it should be easy to debug
  • m

    mysterious-toddler-20573

    06/29/2022, 1:40 PM
    iirc, there may be some API changes that affect it
  • a

    abundant-spring-38265

    06/29/2022, 1:40 PM
    no, if I have hx-ext="client-side-templates" anywhere in my DIV's I don't see any response from hx-get request
  • m

    mysterious-toddler-20573

    06/29/2022, 1:40 PM
    in nunjucks
  • m

    mysterious-toddler-20573

    06/29/2022, 1:40 PM
    huh
  • m

    mysterious-toddler-20573

    06/29/2022, 1:40 PM
    do you see the request in the dev console?
  • a

    abundant-spring-38265

    06/29/2022, 1:40 PM
    here is the response I get before I add client-side-templates: { "items": { "task_creation_time": "Wed, 29 Jun 2022 13:37:08 GMT", "task_end_time": null, "task_id": "0f527518-4809-4d3b-ae8e-874722c3dd26", "task_progress": {}, "task_result": null, "task_start_time": "Wed, 29 Jun 2022 13:37:08 GMT", "task_status": "started" }, "status": "success" }
  • m

    mysterious-toddler-20573

    06/29/2022, 1:41 PM
    https://unpkg.com/htmx.org@1.7.0/dist/ext/client-side-templates.js
  • m

    mysterious-toddler-20573

    06/29/2022, 1:41 PM
    this is the sum total of the extension, not very much!
  • m

    mysterious-toddler-20573

    06/29/2022, 1:41 PM
    i don't see how it's possible the extension could break requests
  • m

    mysterious-toddler-20573

    06/29/2022, 1:41 PM
    and yet here we are
  • m

    mysterious-toddler-20573

    06/29/2022, 1:41 PM
    grug grim smile
  • a

    abundant-spring-38265

    06/29/2022, 1:42 PM
    question is which DIV do i add: hx-ext="client-side-templates" 🙂
  • a

    abundant-spring-38265

    06/29/2022, 1:42 PM
    as adding it makes "task_output" disapear (hx-target)
  • m

    mysterious-toddler-20573

    06/29/2022, 1:44 PM
    it should be added on a parent element, and then you place the
    nunjucks-template
    attribute on the element that issues the request
  • m

    mysterious-toddler-20573

    06/29/2022, 1:44 PM
    let me put together a codepen
  • a

    abundant-spring-38265

    06/29/2022, 1:45 PM
    here is my code for reference 😉 Current Running Task Progress <div hx-get="/tasks/{{ data.job.id }}" hx-trigger="every 1s" hx-target="#task_output" nunjucks-template="job_rq_template"> {{ items }}
1...728729730...1146Latest