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

    mysterious-toddler-20573

    05/17/2023, 1:05 AM
    https://twitter.com/ThePrimeagen/status/1658574536411938816
  • m

    mysterious-toddler-20573

    05/17/2023, 1:05 AM
    will be online in a bit and will try to help…
  • g

    gorgeous-airport-54386

    05/17/2023, 1:06 AM
    (he's in primeagen's house holding him at gunpoint)
  • g

    great-cartoon-12331

    05/17/2023, 1:23 AM
    (or rather at grugpoint)
  • g

    gorgeous-airport-54386

    05/17/2023, 1:23 AM
    at clubpoint
  • r

    refined-waiter-90422

    05/17/2023, 1:25 AM
    The power of memers
  • c

    colossal-guitar-8828

    05/17/2023, 1:31 AM
    when i make an element do hx-post what exactly does it send as the body? and is there a way to change it?
  • g

    great-cartoon-12331

    05/17/2023, 1:38 AM
    see https://htmx.org/docs/#parameters
  • c

    colossal-guitar-8828

    05/17/2023, 1:41 AM
    ty
  • f

    few-parrot-58207

    05/17/2023, 1:45 AM
    I don't want to alarm anyone, but it might actually be the case that 3 different people at least are using OCaml and htmx
  • f

    few-parrot-58207

    05/17/2023, 1:45 AM
    (that I know of, so possibly more!)
  • c

    colossal-guitar-8828

    05/17/2023, 1:55 AM
    wait so if i wanted to submit an entire form would i put the post on the form element or the submit button element
  • g

    great-cartoon-12331

    05/17/2023, 2:02 AM
    on the form.
  • r

    red-farmer-97020

    05/17/2023, 2:21 AM
    What's the cleanest way to have form inputs change based on the value of a different input? I've got a form where there's a number input that decides how many dropdows there are on a page. Simplest way I can think of is to send the entire form on keystroke/change (denounced) to the server to figure out when to swap in the new updated form with the correct number of fields. Is that a good approach?
  • c

    colossal-guitar-8828

    05/17/2023, 2:37 AM
    so i have this form thing that should post its data from what i understand, but when i get the body of the request its blank, is there smth im missing?

    https://cdn.discordapp.com/attachments/725789747212976259/1108221675755032646/image.png▾

  • c

    colossal-guitar-8828

    05/17/2023, 2:37 AM
    server code

    https://cdn.discordapp.com/attachments/725789747212976259/1108221736064909322/image.png▾

  • m

    mysterious-toddler-20573

    05/17/2023, 2:38 AM
    STONKS
  • m

    mysterious-toddler-20573

    05/17/2023, 2:38 AM
    cross domain is probably messing w/ it, just pare it down to
    hx-post="/api"
  • c

    colossal-guitar-8828

    05/17/2023, 2:40 AM
    still nothing
  • g

    great-cartoon-12331

    05/17/2023, 2:43 AM
    is the request reaching the backend? is it being logged?
  • c

    colossal-guitar-8828

    05/17/2023, 2:43 AM
    yep, the problem was that i forgot to add the name element to the inputs 💀
  • m

    mammoth-family-48524

    05/17/2023, 3:43 AM
    It’s always the name attribute
  • p

    proud-librarian-99598

    05/17/2023, 7:10 AM
    I am implementing something similar for inline editing of a single field and I did it like this (Using alpine):
    Copy code
    <div id="title-edit-form-wrapper">
    <form id="title-form"
      hx-put="/123/title"
      hx-trigger="keyup[key=='Enter']"
      hx-swap="outerHTML"
      @keyup.escape="htmx.ajax('GET', '/123/title', {target: '#title-edit-form-wrapper', swap: 'outerHTML'})"
    >
      <input type="text" id="title" name="title" value="This is a test" autofocus>
    </form>
    </div>
    This does a PUT request if the user presses ENTER (via the
    hx-trigger
    ), but does a GET request when the user presses ESC.
  • m

    microscopic-lifeguard-45888

    05/17/2023, 8:27 AM
    Hey all, I'm assessing htmx for adaption by my team. We built applications/integrations for platforms like atlassian and monday.com. Htmx's model seems to be a great match for what we do, the only major downside I run into so far is that these platforms provide styled component libraries for easy integration with their platform which are based on react. Not having to spent time on creating and styling these components ourselves is obviously really valuable. I'm still willing to explore how much effort it is to maintain htmx-based versions of such styled-components ourselves. Anyone here been in a similar situation? What's your experience been?
  • m

    mammoth-family-48524

    05/17/2023, 10:23 AM
    Hello! 👋 I haven't done it with React components, but using https://shoelace.style - a web component library - was pretty straightforward. Things generally worked out-of-the-box except I had to tell HTMX which components I wanted it to include in http requests - which was fine really. I didn't need to make any HTMX specific versions of the components. I don't really know what that would look like TBH. After a little while I ended up having a go at making an HTMX extension (which was super easy) to make forms with shoelace components work the same way as forms with standard HTML elements https://github.com/benopotamus/htmx-ext-shoelace.
  • m

    mammoth-family-48524

    05/17/2023, 10:44 AM
    I created a StackOverflow question based on question. Given how common that error is, and with HTMX only being a few months away from taking over web development, I'm expecting quite a LOT of up votes 😂
  • m

    microscopic-lifeguard-45888

    05/17/2023, 10:58 AM
    Thanks for the input! I'm still trying to wrap my head around the way-of-working that htmx proposes so can't say I 100% follow what your doing (or what my options are) but it looks intersting so I'll have a better look. I was under the impression that using htmx i.c.w. react would be a clash in models and not really workable but maybe I'm misunderstanding? Could I use react to render the components from these libraries but add htmx-tags to realize the interactivity?
  • f

    famous-monitor-57000

    05/17/2023, 10:59 AM
    Is it possible to use a value from a form within
    hx-push-url
    ? For example, something like this:
    Copy code
    <form hx-push-url="/page/{input.example.value}">
      <input name="example" value="123">
      <button type="submit">
    </form>
    So when you click the button, the URL updates to
    /page/123
    ?
  • m

    mammoth-family-48524

    05/17/2023, 11:06 AM
    I’m not sure tbh. I only have a little bit of experience with react, and that was a while ago. Hopefully someone who knows what they’re talking about can answer 🤷‍♂️😂
  • m

    mysterious-toddler-20573

    05/17/2023, 11:25 AM
    if the submission is a get, it should automatically be included. Otherwise you can construct the URL server-side and respond w/ the
    X-Push-Url
    header
1...113111321133...1146Latest