⚠️ This post links to an external website. ⚠️
I’ve been writing LiveView since 2020. In that time, I’ve seen the same three form mistakes at multiple companies. Here’s what they are and how to fix them.
1. Slow, laggy forms with scattered logic because form state gets stored in socket assigns and server round-trips get used for dynamic UI (conditional inputs, toggles), instead of keeping that state in hidden form inputs where it belongs.
2. Brittle system where UI and database can’t evolve independently because database schemas get used directly for forms, coupling persistence logic to presentation.
3. Users stuck with valid data but can’t submit because changesets get manually manipulated with
Map.putorMap.mergeinstead ofEcto.Changesetfunctions, leaving stale errors behind.The common thread: don’t fight the framework. Keep form state on the client, create embedded schemas for your forms, and use
Ecto.Changesetfunctions to modify changesets.
continue reading on johnelmlabs.com
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.