By ‘dynamic form’ I mean an HTML form where the inputs can change based on
how the user populates the form. I tend to need this when there is an array
type in the data and the number of elements in the array is specified by the
user, or when there is a union type in the data and I want to change the
inputs shown based on the case selected by the user. An example is worth a
thousand more words.
In this tutorial, our developer advocate Khalid Abuhakmeh introduces you to
HTMX, and how to integrate it into your ASP.NET Core apps.
JetBrains’ support for htmx is still quite surreal. The tutorial is freely
available to all:
ASP.NET Core developers predominantly spend their development time on the
server, trying their best to steer clear of the scary world of client-side
development. But here’s a secret, it doesn’t have to be a daunting prospect
to build client-side experiences if you use HTMX. Learn what HTMX is, how to
integrate it with your existing knowledge of ASP.NET Core development, and
how to take your client-side development to the next level with relative
ease. You’ll never look at client-side development the same way ever again.
Rashad Gover, Hypermedia-Driven Web Apps in Haskell
In this talk I present a new approach to building web apps in Haskell, using
htmx. htmx gives you access to AJAX, CSS Transitions, WebSockets and Server
Sent Events directly in HTML, using attributes, so you can build modern user
interfaces with the simplicity and power of hypertext. With the power of this
technology, Haskellers can now build 100% Haskell web apps without depending
on GHCJS. I’ll also be briefly showcasing a new microframework based on
monadic parsing called Okapi. Okapi was inspired by F#’s Giraffe, and is
meant to be a lightweight, simple tool used for rapid prototyping and
learning server-side web development.
Seems pretty positive so far, right? But there are some caveats…
I hadn’t even thought of this, since I never try to view local HTML files
without a server. That’s why participating in the development of things you use
is important! 🐝
The _hyperscript codebase has grown quite quickly, and to simplify it, we need
Would you be fine with needing a dev server to run a file? (i.e.:
python3 -m http.server)
Do you need to support browsers that lack ES Modules?
How to test HTML templates
This story is very important and definitely not a front for me to promote
Use the 204 No Content status code to optimize polling
A user had a table being polled every 2 seconds. The table was being augmented
— regardless of whether the table changed.
You can use the 204 No Content status code to tell browsers they should keep
showing the old page, and htmx respects this convention by not swapping.
There is actually a bit of a debate about whether htmx should swap 204
responses. I hold that if you need anything visible to happen upon the response
being received, 204 is the wrong status code to use — use 200 OK with an
empty body instead.