jacobobryant / jacobobryant/experiments

form example

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
agent
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Create a simple clojure web app that we'll use to compare different methods of dealing with forms. use the jetty webserver and reitit for routing. Use lambdaisland hiccup for rendering html. no need for any middleware or auth. get the web app running and make a sprite service for it. I want to be able to try it out from my browser.

Start out by adding a page with a few form-things:

- at the top of the page there should be a table with 50 rows. each row represents an "item". each item has a name (we can just do "item 1", "item 2" etc) and a quantity (default 0). the quantity is an editable text field. At the top and bottom of the table there are "save" buttons. We can store server-side state in an atom. it doesn't need to persist.

- each item row should also have plus and minus buttons for the quantity which submit the form immediately.

- beneath the table, there should be a second form. We can say it's a "settings" form, but it doesn't really matter what it is; we just want some kind of form. let's put a few inputs in it: (1) a text field, (2) a select field, (3) a date picker.

This page should be a plain html form ideally with zero javascript. Just plain post-and-redirect.

Then, duplicate this page into two more pages. Modify one of these pages to use htmx with boost mode and idiomorph swapping (you'll need to add the idiomorph extension). So the form elements and backend handlers should mostly if not all remain the same.

the 3rd page should use datastar. datastar doesn't have a "boost" mode so I believe we'll need to modify the forms a bit for this case. use datastar's "form" content type thing so that doing a @post will submit the form-encoded input values for the enclosing form. we won't use any signals. then modify the buttons so they do datastar @post things. And finally, provide another set of backend handlers that rerender the entire page and return it to datastar for swapping instead of doing a redirect.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting the repository's existing Clojure application structure and entry points. Build the plain HTML form page first, then duplicate it for the htmx/idiomorph and datastar variants. Done means all three pages run in the browser, support the specified forms and quantity actions, and the datastar handlers rerender the page for swapping.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, html
Domain
full-stack, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.