BarelyFunctional

BarelyFunctional

Idiomatic LiveView dynamic/nested forms

I’m starting to build a multi-step/page ‘wizard’ form, but from these forums and web tutorials, struggling to find the idiomatic way to build a dynamic form.

The simplest use case is:

  1. User clicks or presses Enter to choose an option from a select,
  2. Depending on the option another form element is displayed eg another select or radio buttons or a text field.
  3. Some steps/pages will have forms that have 3-5 elements, each depending on the previous one.

I know this is one of the most basic use cases for LiveView, but I’m struggling to find a simple example.

Can anyone please point to one in these forums or in an online tutorial or put an example up below?

Thanks

Most Liked

f0rest8

f0rest8

The good news is that there is very little to do to update my older blog post mentioned above to 0.16.1:

And making the update further cleans up the code a bit (:blush:).

You can follow the changelog guide and reference the live view docs as well. After the update, you can totally get rid of the templates/person_registration and just render it all in your live view with that wonderful ~H.

Here’s a new updated post with the changes:

https://coretheory.medium.com/how-to-part-2-revised-swap-registration-flow-to-a-live-view-with-phx-gen-auth-multi-step-47172904b00a?sk=50ebdd6e8e66cb278a2c40a0c3db415a

Hope it helps :heart:

APB9785

APB9785

Creator of ECSx

Here are some links that might be helpful:

https://medium.com/swlh/how-to-part-2-swap-registration-flow-to-a-live-view-with-phx-gen-auth-multi-step-form-25371540fce1

Where Next?

Popular in Questions Top

Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36820 110
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40165 209
New

We're in Beta

About us Mission Statement