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

    able-park-18255

    12/04/2022, 9:46 PM
    ahh i see if i wrap in a form it works
  • a

    able-park-18255

    12/04/2022, 9:47 PM
    https://htmx.org/docs/#parameters seems like by what it says here though a value of a button should still be included in the request, since a element can have a value.
  • m

    mammoth-family-48524

    12/04/2022, 10:02 PM
    I saw that in the docs as well but didn’t have a good space to debug it 😂. @mysterious-toddler-20573 do you want people to raise these sorts of things as issues in GitHub, or do you add issues from this channel when you think they’re worth addressing? How do we best help? 🙂
  • a

    able-park-18255

    12/04/2022, 10:45 PM
    I'm noticing that there seems to be caching going on when i check my little app on mobile. it's updating all my todo items with a block of html i'm swapping out. I checked the headers and
    cache-control
    is set to
    no-cache
  • a

    able-park-18255

    12/04/2022, 10:45 PM
    sure seems like this is cache though.
  • m

    mysterious-toddler-20573

    12/04/2022, 11:35 PM
    seems like a bug, I'd say open a github issue
  • m

    mysterious-toddler-20573

    12/04/2022, 11:35 PM
    I think you could work around it by encoding the id in the URL, which might be a bit more REST-ful
  • m

    mysterious-toddler-20573

    12/04/2022, 11:36 PM
    Copy code
    html
    <button class="ml-auto text-red-500" hx-delete="/wp-json/wauble/v1/todo/1/delete/" hx-swap="innerHTML" hx-target="#todos-list">Delete</button>
  • m

    mysterious-toddler-20573

    12/04/2022, 11:36 PM
    (no need for an explicit trigger either)
  • a

    able-park-18255

    12/05/2022, 1:36 AM
    there a way to grab html out of JSON that's returned?
  • m

    mammoth-family-48524

    12/05/2022, 1:54 AM
    Does your backend only do JSON? The obvious solution is return snippets of HTML for HTMX to put into the DOM
  • a

    able-park-18255

    12/05/2022, 2:12 AM
    Ya that’s what I’m currently doing. Returning html with text/html header from a Wordpress REST route. Just trying to keep it RESTy. Several tutorials say not to return html from a rest route in wp. Typically I do just parse html from JSON. Kinda surprised this isn’t an html atty
  • c

    cuddly-keyboard-70746

    12/05/2022, 2:15 AM
    @able-park-18255 htmx has some essays that you should check out (the ones about hateoas and rest)
  • c

    cuddly-keyboard-70746

    12/05/2022, 2:16 AM
    tl;dr; htmx expects HTML responses and that's REST. JSON just isn't (despite that not being what most people will tell you, that doesn't mean it is right)
  • a

    able-park-18255

    12/05/2022, 2:18 AM
    Gotcha. Reading about HATEOAS
  • a

    able-park-18255

    12/05/2022, 2:19 AM
    I guess this could be done pretty easily with WP and permalinks
  • a

    able-park-18255

    12/05/2022, 2:20 AM
    I used htmx to create an Ajax search component using a static template in WP. Worked pretty well and no need to create rest endpoints
  • a

    able-park-18255

    12/05/2022, 3:07 AM
    Would be cool to see some stuff about pairing htmx and Wordpress
  • m

    mysterious-toddler-20573

    12/05/2022, 3:36 AM
    https://htmx.org/essays/how-did-rest-come-to-mean-the-opposite-of-rest/
  • a

    ancient-father-3063

    12/05/2022, 6:01 AM
    Copy code
    html
          <select class="select form-control" hx-get="/listofarchetypes" hx-include="#deckdoctor" hx-target="#id_archetype" hx-trigger="load, change" id="id_mtgFormat" name="mtgFormat" required=""> <option value="">---------</option> <option selected="" value="1">Legacy</option> <option value="2">Vintage</option>
          </select>
  • a

    ancient-father-3063

    12/05/2022, 6:01 AM
    sorry I still can't understand why this is not including the value from the div deckdoctor
  • a

    ancient-father-3063

    12/05/2022, 6:02 AM
    does it mater where the div is on the page?
  • a

    ancient-father-3063

    12/05/2022, 6:02 AM
    Copy code
    <div class="deckdoctor" id="deckdoctor" name="deckdoctor" value="1">
              <p>deck doctor here</p>
            </div>
  • a

    ancient-father-3063

    12/05/2022, 6:02 AM
    it just looks like this
  • a

    ancient-father-3063

    12/05/2022, 6:06 AM
    but that div id and the value are not included in the request.get
  • m

    mammoth-family-48524

    12/05/2022, 7:13 AM
    What does it do when you change the get to a post?
  • a

    ancient-father-3063

    12/05/2022, 8:09 AM
    the post request is empty...
  • a

    ancient-father-3063

    12/05/2022, 8:09 AM
    to be honest I never used hx-post before
  • r

    ripe-action-67367

    12/05/2022, 8:17 AM
    > Note that if you include a non-input element, all input elements enclosed in that element will be included.
  • r

    ripe-action-67367

    12/05/2022, 8:17 AM
    https://htmx.org/attributes/hx-include/
1...932933934...1146Latest