This may be a bit of a stretch for this forum, but I had to share this with someone and this forum is really the only place I know that can appreciate it. Twelve years ago, I nearly quit the industry because I couldn’t figure out how to get my client’s spec of a multi-part form to work with Django’s internal ORM and form systems. Today, I built exactly that (minus the Ecto part) with Phoenix and LiveView. To say that I am appreciative of the whole team’s work with Elixir, Phoenix, and LiveView would be a giant understatement. Now that I’ve come full circle, I look forward to many more years of Elixir to come!
You can find the code here: GitHub - danieljaouen/phoenix_modal_example and a short blog post about the update here: Multi-Part Form With LiveView – Daniel Jaouen Development.
Thanks for reading!!
13 Likes
Nice! Thanks for sharing. I’m always interested to see different approaches to common problems (and multi-step forms seem to be very common). I can also relate to moments where something didn’t click (or did whatever’s opposite to “clicking”–squishing?), building fogs of uncertainty whether buckling down and continuing a certain route is actually worth the payoff.
Did you use any specific resources (tutorials, for example) about multi-step LiveView forms? There are quite a few floating around.
At risk of looking like I’m taking over your thread–if you or anyone else has tutorials or methods to share I’d be interested in seeing them. I’m currently building some generic functions to handle multi-step forms with treeishlike, conditional steps. So you can write something like
@steps [
{"1", ["name": "First"]},
{"1.a", ["name": "A"]},
"1.a.1",
{"1.b", ["name": "B"]},
"2"
]
and pass it into the library to generate a flow of 1 → ((1.a → 1.a.1) / 1.b) → 2 (if that makes sense). The current / next steps are automatically handled (so no needing to manually point to the next step). It allows manual overrides and infinitely long / deep (/ confusing) forms.
Anyway, just putting it out there if anyone is interested (in talking about it, etc.) It’d be helpful to know if anyone else has done (is doing) this in open-source already.