DEV Community

Dillon Headley
Dillon Headley

Posted on

1

HTMZ inspired form subission

This is a submission for DEV Challenge v24.03.20, Glam Up My Markup: Camp Activities

What I Built

I was inspired by htmz (which was in turn inspired by htmx) and how the author got pretty close to a basic htmx-like experience just using an iframe. I wanted to push it a little further so whipped this demo together. My submission demonstrates progressive enhancement for the form - with js enabled the request targets an iframe that is inserted into the dom, meaning the page doesn't actually navigate (similar to event.preventDefault()). The iframe receives the html response from the request and on load triggers a function to swap out it's contents into the main page.

Demo

You can find my demo here: https://glam-up.netlify.app/
And the code here: https://github.com/dillonbheadley/glam-up

Journey

I put this together pretty quickly so there are probably bugs or things I haven't dealt with or handled (like validation). For simplicity I just used Netlify's edge functions and js template literals for "components".

I think you could get pretty far with this little setup for simple sites/apps with very little overhead or maintenance. It was fun to mess around with at least! I'd be happy to answer any questions.

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

Instrument, monitor, fix: a hands-on debugging session

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️