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

    mammoth-family-48524

    05/12/2023, 12:55 AM
    Server side representation? 😈
  • m

    mammoth-family-48524

    05/12/2023, 12:56 AM
    Server side HTML - SSH šŸ˜‚
  • p

    powerful-napkin-20086

    05/12/2023, 2:08 AM
    Are there examples of having a dynamic form. For example a form with an input field and a "+" button to add a new field below it. Each time you click + it appends a new input field. For example a shopping cart and + adds a new line item
  • i

    icy-minister-29342

    05/12/2023, 2:09 AM
    i'm starting something new and i am thinking about htmx and wondering for an open source project that is basically a CRUD app and designed to be accessible to everyone, including people who are just starting out coding what do y'all think the simplest stack would be? (the simplest one that is good: something that won't be outgrown and isn't tedious. CRUD should be easy like it is in Rails) I'm thinking the right answer probably includes JS rendering templates on the server side and htmx on the frontend?
  • g

    great-cartoon-12331

    05/12/2023, 2:18 AM
    the simplest stack may not be the same as the easiest stack for people who are getting started with coding. RoR may be the easiest one but even with that for web dev you need a certain baseline level of expertise
  • g

    great-cartoon-12331

    05/12/2023, 2:20 AM
    another option may be Racket as it is designed to be easy to learn: https://docs.racket-lang.org/continue/index.html
  • g

    gorgeous-ghost-95789

    05/12/2023, 2:27 AM
    Yes! Here's a "grid" widget in the app I'm building right now. You can add/edit/delete rows directly into the table, which writes back to the server pretty instantly. Here's a video of my dev instance: https://cdn.discordapp.com/attachments/725789747212976259/1106407217781026866/Dynamic-Form-Example.mp4
  • g

    gorgeous-ghost-95789

    05/12/2023, 2:31 AM
    The code is built for a production system, so it's not the best demo code to dig through. But in case it helps: Here's the widget code: https://github.com/benpate/table And here's the code that's running in the video: https://github.com/EmissarySocial/emissary/blob/main/render/step_EditTable.go
  • g

    gorgeous-ghost-95789

    05/12/2023, 2:37 AM
    In general, an editable form is pretty straightforward to accomplish. A few things I decided on while building this: 1. Swap out the whole
    <table>
    , not individual ``s. This is because of some funkiness in targeting rows in a table that make it error-prone. For me, it was easier to redraw the whole table each time. 2. Because of this, it's simpler to only allow editing on one row at a time. In the widget I showed, clicking on another row will de-select the previously selected row. 3. It basically works like a state machine. There's VIEW and EDIT states with actions that move between them (add a blank row, select a row, post a change, delete a row, cancel changes)
  • g

    gorgeous-ghost-95789

    05/12/2023, 2:40 AM
    Agreed. This same dilemma comes up with htmx itself. People will look at the examples, which are intended to demonstrate a specific tag or feature, then be confused about using it in the real world. We get specific feedback about accessibility every now and then, even though the point of the examples isn't to showcase that particular feature. On the flip-side, code that's really easy to use in production can be a bear to step right into. 😦
  • b

    bitter-machine-55943

    05/12/2023, 3:52 AM
    Methinks ā€œsimplestā€ and ā€œwon’t be outgrownā€ are in conflict. Something that won’t be outgrown will be batteries included and those usually go a mile deep.
  • i

    icy-minister-29342

    05/12/2023, 3:56 AM
    Simplest was maybe not the right word - I was thinking more "easy for a beginner to contribute to".
  • b

    bitter-machine-55943

    05/12/2023, 4:13 AM
    Easy for beginners is a framework/library that uses simple functions that accept requests and return responses. But that’s only easiest in the sense that it has a concise Hello World app. Something that grows is back to batteries included. So rails, Laravel, Django, Phoenix, etc. I don’t think there’s a shortcut.
  • b

    bitter-machine-55943

    05/12/2023, 4:14 AM
    However, I’ve thought about writing project setup scripts that get someone to a point where they can start building. Something that uses a batteries included framework but let’s you start with the simple hello world. Batteries included with training wheels.
  • b

    bitter-machine-55943

    05/12/2023, 4:19 AM
    I think beginners will benefit more if they can focus on one small piece. Once they understand a small piece, then they have a foothold to expand from. So with Django for instance, they could focus on just making a model, and all the other parts get auto-generated (views, templates, admin, routes, serializers). I’ve got the automatic views, admin, and serializers done so far.
  • c

    cuddly-keyboard-70746

    05/12/2023, 5:45 AM
    and HTML server?
  • c

    cuddly-keyboard-70746

    05/12/2023, 5:45 AM
    i dont think there is nothing micro about the aproach, i hate that proposal
  • c

    cuddly-keyboard-70746

    05/12/2023, 5:46 AM
    at this point ssr looks like a lost cause, perhaps getting away is better
  • c

    cuddly-keyboard-70746

    05/12/2023, 5:51 AM
    yeah its pretty hard to answer that... i guess in the end it depends of what they want to do... I am biased to kotlin, not the easiest but has an interesting type system and can be good to introduce to strongly typed langs. While js could mean one less language to learn, you may be able to use close to no js in the frontned. on the other side i have come to despise js
  • c

    cuddly-keyboard-70746

    05/12/2023, 5:52 AM
    python maybe, or regular ruby if RoR is too much? (ror maybe actually the best option as it helps with the while db and all)
  • w

    wooden-magician-49694

    05/12/2023, 12:47 PM
    Is it possible to delay the hx-indicator ? If the request takes ie. < 500ms its basically only a flicker which doesnt make much sense. I couldnt find any option and failed to do it with a css transition. Any ideas?
  • i

    icy-minister-29342

    05/12/2023, 12:56 PM
    Hm yeah I agree. I've been working with rails for 16 years and was just in the mood for something new lol šŸ˜…Thanks for responding!
  • w

    wooden-magician-49694

    05/12/2023, 1:39 PM
    I may have succeeded in hacking something in css that makes it work (using transition delays with visibility,opacity) but I still think there ought to be a better default in htmx
  • l

    limited-teacher-83117

    05/12/2023, 2:28 PM
    I've come to the exact same conclusion for forms as well
  • w

    worried-portugal-65416

    05/12/2023, 2:41 PM
    I agree. Ran into this a while ago and dropped the indicator altogether as it was making a bit of a mess for quick request-response cycles.
  • h

    hundreds-camera-24900

    05/12/2023, 2:44 PM
    someone on my team just got bit by https://github.com/bigskysoftware/htmx/issues/1221
  • h

    hundreds-camera-24900

    05/12/2023, 2:44 PM
    sorry to return and be like "here's a bunch of my issues"
  • h

    hundreds-camera-24900

    05/12/2023, 2:44 PM
    lol
  • m

    mysterious-toddler-20573

    05/12/2023, 3:26 PM
    šŸ˜‘
  • h

    hundreds-camera-24900

    05/12/2023, 3:50 PM
    it makes me feel like I bring value
1...112611271128...1146Latest