Programming Phoenix LiveView B9: chapter 5 typos (PDF)

The first heex block of code in the section The Promo Live View should just be the <.header>; the code errors out if you include the form here because :changeset isn’t assigned yet.

Like other form blocks, the :let={f} bit isn’t necessary, and the fields should be something like field={@changeset[:name]}. But, to get that to work, the code for assign_changeset on page 132 should be

  def assign_changeset(%{assigns: %{recipient: recipient}} = socket) do
    socket
    |> assign(:changeset, to_form(Promo.change_recipient(recipient)))
  end

The last bit in handle_event for validate on page 135, also needs to use to_form for the changeset.

allow_upload on page 143: inside the update function, the allow_upload(:image, ...) should show up before assign(:changeset, changeset).