Now fully updated for Phoenix 1.8!

Mastering Phoenix forms

The definitive guide to building complex, powerful forms with Phoenix, LiveView, and Ecto

Benjamin Gandhi-Shepard

“This is the most important course you will find online for mastering Phoenix Forms. Not only do you learn the “how”, you’ll also learn "why" Phoenix forms are designed as they are. This course puts all you need to know in an organized, concise and practical format. I highly recommend it.”

Sven Van Caekenberghe

“This course covers a huge amount of ground. I love George’s style starting from realistic example projects that you work on step by step, with clear code diffs, animated screenshots/screencasts, IEx command line sessions and git commits. With a bunch of bonus lessons, you will learn about even more useful subjects than just forms.”

Get the free preview:

Forms in Phoenix don’t have to be difficult

Phoenix, Ecto and LiveView let you build complex, interactive forms at lightning speed - but there’s a learning curve.

To know what you’re doing, you need to understand a whole bunch of overlapping concepts: changesets, schemas, validations, <.form> and to_form/1, nested params, associations, embeds, CoreComponents and more.

Mastering Phoenix Forms is the ultimate guide that will make everything clear, once and for all. In my usual style, it’s a written course with 60 lessons. (See below for the full table of contents.)

You’ll build two Phoenix apps that illustrate everything you need to know about forms - from a simple “deadview” form with basic inputs, to a complex LiveView with dynamic nested associations and all the other tricky stuff.

I’ve figured out everything you need to know and organized it into clear, concise, logical steps. You’ll start from the basics and build things up piece by piece, each new concept being introduced at exactly the right time for maximum learning and understanding.

By the time you’re done, you’ll wonder what you ever found confusing. Phoenix forms don’t have to be difficult - I promise. All it takes is a clear, organized understanding of how the different parts of the stack fit together. Once you have this conceptual outline, you’ll be building complex, dynamic forms at blazingly fast speeds. You’ll see once again why LiveView is the best stack out there - you just won’t believe how quick and easy it becomes to write complex, powerful yet maintainable code!

Convinced? Buy it for life

No subscription, no time limit. Lifetime access with a single payment.

FULL COURSE
  • Forms course
  • Lifetime access
  • 60 lessons + full source code
  • All future updates for free
$99
$49
Buy now
2-COURSE BUNDLE
$228
$99
Buy now

Questions

What’s the format?

Like my previous courses, Mastering Phoenix Forms is a written course containing 60 lessons.

In Part 1, you’ll learn how to build forms with a static “deadview” controller. In Part 2, you’ll expand on what you’ve learned and see how everything works with LiveView. Then in the Bonus Lessons, you’ll explore some miscellaneous topics such as security, multi-step forms, form recovery, and more. >

What about Ecto?

In Phoenix, forms and Ecto are two sides of the same coin. But that’s the confusion: you need to learn Ecto before you can build an effective form, but it can also feel like you need to understand forms before you can get your head around Ecto.

I’m here to clear things up. I’ve figured out the dependency graph between all these interlocking concepts - I’ll take you gently from the simple to the complex and explain everything in an order that makes maximum sense.

What about Tailwind?

Since Phoenix 1.7, newly-generated Phoenix apps use Tailwind CSS for their styling. You don’t have to use Tailwind in your Phoenix project - it’s easy to, for example, use SASS, LESS, or vanilla CSS instead - but Tailwind is the default.

Tailwind is a simple framework that’s very easy to learn. The apps you’ll build in Mastering Phoenix Forms use Tailwind for their styling, but you don’t need a deep knowledge of Tailwind to understand the tutorial.

Does it cover [topic X]?

I’ve included every form-related topic I could think of. The syllabus includes, but is not limited to:

  • understanding <.form>, to_form/1, %Phoenix.HTML.Form{}, and how they interplay.
  • building complex, custom validations with Ecto.
  • making dynamic, nested forms with both cast_assoc and cast_embed.
  • building multi-page forms in a single LiveView.
  • thoroughly examining CoreComponents, including various advanced tricks you may have missed in <.input />.
  • how Phoenix parses HTTP params into nested data structures.
  • enhancing your forms with Javascript hooks.
  • effective errors, including LiveView’s new used_input? helper.
  • working with embedded data and relational associations.
  • dealing with latency, and improving your form’s UX on slow connections.
  • best security practices so your forms remain unbreakable.
  • internationalizing your forms with gettext.
  • integrating your forms with 3rd-party Javascript libraries.
  • recovering from disconnects with phx-auto-recover

See below for the full table of contents.

What’s the stack?

The tutorial uses the latest version of everything as of 2025: Elixir 1.18, Phoenix 1.7, and LiveView 1.0. It will be kept updated as new versions of these technologies are released in the future.

Isn’t Phoenix 1.8 coming out soon? Will the course be kept up-to-date?

Phoenix and LiveView are continually receiving new features and upgrades. As with my other courses, I’ll keep Mastering Phoenix Forms up-to-date with all and any future changes to the framework. Once you buy the course you’ll have lifetime access to all future updates for free.

Do I need to know Phoenix already?

I’ve tried to minimize the amount of existing Phoenix knowledge that’s required to take this course. If I don’t teach a concept directly, I’ve added the necessary code to the starter app(s) so that you shouldn’t need to worry about it.

Still, Mastering Phoenix Forms probably isn’t suitable for the total Phoenix beginner. If you’re not familiar with basic concepts like the router, controllers, or HEEx, you might want to take a beginner’s tutorial before going deep on forms.

I have another question.

I’d love to hear it! Get in touch on george@arrowsmithlabs.com.

You’ll learn Phoenix forms thoroughly from this course - I guarantee it. Sign up, and if you aren’t impressed, send an email within 30 days of purchasing and I’ll give a full refund.

“This is hands down the best Phoenix-focused online course I’ve seen. It does an excellent job of covering the topic in a clear and approachable way and includes links to more detail as required on topics where this is definitely appreciated. When more complex topics are covered, detail is provided to help the concept sink in. I especially appreciated the fact that the most recent 1.8 version is covered in the forms course.”

Table of contents

01 Introduction


Part 1. Static forms


02 Setup


03 The Contact schema


04 The Contacts context


05 Form basics


06 form/1


07 Nested params


08 Changesets


09 Validation


10 Phoenix.HTML.Form


11 Changeset action


12 translate_error/1


13 input/1


14 Custom error messages


15 Uniqueness validations


16 Edit and update


17 Checkboxes


18 Textareas


19 XSS


20 Select


21 Ecto.Enum


22 Date inputs


23 Custom validations


24 LiveView introduction


Part 2. LiveView


25 The starter app


26 Live forms


27 phx-change


28 phx-submit


29 Security


30 used_input?


31 Debouncing


32 Latency simulation


33 phx-submit-loading


34 phx-disable-with


35 Hooks


36 Live action


37 Live file uploads part 1


38 Live file uploads part 2


39 Live file uploads part 3


40 3rd-party Javascript part 1


41 3rd-party Javascript part 2


42 Embedded schemas


43 cast_embed


44 inputs_for


45 sort_param part 1


46 sort_param part 2


47 sort_param part 3


48 drop_param


49 sort_param part 4 (Sortable.js)


50 Associations and preloads


51 cast_assoc


52 phx-trigger-action


Bonus lessons


53 Plug.MethodOverride


54 CSRF part 1


55 CSRF part 2


56 I18n part 1


57 I18n part 2


58 Form recovery


59 Multi-step forms


60 phx-auto-recover