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

    mysterious-toddler-20573

    08/06/2022, 5:32 PM
    https://twitter.com/divclassbutton/status/1555965906022531073
  • a

    aloof-football-7378

    08/06/2022, 6:36 PM
    Hi guys I'm trying to render a mustache template and have a JSON of following structure:
    Copy code
    json
    customers:[{id:1,..},{id:2,...},{id:3,...}]
    However, the output comes out as empty. What could be the issue? This is exactly how I defined the template
    Copy code
    html
    {{#customers}}
    Id: {{id}}
    {{/customers}}
    Copy code
    html
    {{^customers}}
    Empty list
    {{/customers}}
  • b

    brainy-ice-92385

    08/06/2022, 6:52 PM
    Are you using htmx? Or just rendering a page using mustache in your stack? It would be more helpful to see more of your code.
  • a

    aloof-football-7378

    08/06/2022, 6:53 PM
    I'm using htmx
  • b

    brainy-ice-92385

    08/06/2022, 6:59 PM
    Hm something does seem to have regressed. See this bin I made with the latest htmx version https://jsbin.com/yuduwotifu/1/edit?html,output vs. the one in the client side templates doc https://jsbin.com/qonutovico/edit?html,output
  • b

    brainy-ice-92385

    08/06/2022, 7:00 PM
    Whoops nevermind. I put the htmx include in the wrong place, it works if I move the htmx script above the client side templates script tag
  • b

    brainy-ice-92385

    08/06/2022, 7:00 PM
    In short, I have no idea πŸ˜•
  • a

    aloof-football-7378

    08/06/2022, 7:20 PM
    Hmm. It looks like it's not looping through the json array
  • a

    aloof-football-7378

    08/06/2022, 7:20 PM
    It's only showing one item
  • a

    aloof-football-7378

    08/06/2022, 8:27 PM
    Anyway. Is it possible to pass extra data to mustache?
  • a

    aloof-football-7378

    08/06/2022, 8:41 PM
    I've noticed that it's not rendering when inside HTML. But renders without HTML
  • u

    user

    08/06/2022, 10:40 PM
    what ius the code for roblox sccript
  • i

    incalculable-holiday-29658

    08/08/2022, 9:07 AM
    does the HX-Trigger from the response only triggers if the request is from htmx?
  • b

    blue-ghost-19146

    08/08/2022, 11:18 AM
    Yes, any htmx response headers only apply in the case of an htmx request afaik
  • m

    mysterious-toddler-20573

    08/08/2022, 5:45 PM
    https://twitter.com/LusciousPear/status/1556690249199255552
  • m

    mysterious-toddler-20573

    08/08/2022, 5:45 PM
    "state slice reducers"
  • j

    jolly-kite-167

    08/08/2022, 5:56 PM
    when everyone knows slice reducers should be privatized.
  • l

    late-king-98305

    08/08/2022, 9:06 PM
    Does a boosted form still trigger the
    submit
    event on that form, or is it something else? (I've got an editor that's not updating the text now that it's boosted, and I suspect its "update the parent on submit" logic isn't firing.)
  • d

    dry-window-71739

    08/09/2022, 11:00 AM
    I feel like this might just be a CSS selector question, I'm trying to have multiple search components each with their own results. I'd like to not have to track them with unique id's, but I can't seem to get the results to go into the correct place: https://jsbin.com/hotisageye/edit?html,output - every hx-post result always ends up in the first search div. I've tried every combo of "closest" and "find" that I can think of πŸ™‚
  • t

    tall-dinner-62086

    08/09/2022, 11:05 AM
    find
    and
    closest
    try to find parents and children, they won't match siblings
  • d

    dry-window-71739

    08/09/2022, 11:21 AM
    yep, I thought just .results would do it, but it always does the first one
  • m

    mysterious-toddler-20573

    08/09/2022, 11:21 AM
    maybe try β€œnext”
  • d

    dry-window-71739

    08/09/2022, 11:31 AM
    in hx-target?
  • m

    mysterious-toddler-20573

    08/09/2022, 12:56 PM
    Yep
  • m

    mysterious-toddler-20573

    08/09/2022, 1:00 PM
    https://codepen.io/1cg/pen/YzajPYX
  • m

    mysterious-toddler-20573

    08/09/2022, 1:00 PM
    Copy code
    <button hx-get="/foo"
            hx-target="next output">
      Do It
    </button>
    <output>--</output>
  • d

    dry-window-71739

    08/09/2022, 1:02 PM
    got it - thanks. I had to upgrade my htmx too πŸ˜› https://htmx.org/attributes/hx-target/ should it be documented here?
  • m

    mysterious-toddler-20573

    08/09/2022, 1:05 PM
    it sure should
  • s

    some-hairdresser-28401

    08/09/2022, 1:29 PM
    Just a random thought: What if I could do this (maybe it's possible already but I didn't find it in the docs πŸ˜„ )
    Copy code
    html
    <div id="newcustomerdetails" hx-trigger="CustomerCreated from:location" hx-get></div>
    
    <form hx-post="/customers">
    <!-- some input elements -->
      <button>Add customer</button>
    </form>
    When `POST`ing the
    form
    , the server creates a
    201
    with the
    HX-Trigger
    response header set to
    CustomerCreated
    and the
    Location
    header set to
    /customers/123
    and
    newcustomerdetails
    would be populated with the content from
    GET /customers/123
    . This wouldn't add much value for scenarios that can be targeted using
    hx-target
    but if you have multiple parts of the page to be updated, it might be useful.
  • m

    mysterious-toddler-20573

    08/09/2022, 1:32 PM
    you can do that I think
1...772773774...1146Latest