faried
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).
Marked As Solved
SophieDeBenedetto
Thanks for pointing these out! You’ll find these form changes alongside all the other upgrades in the next Beta release of the book, coming soon.
Regarding your last comment–there’s no reason that I can see that allow_upload should come before the call to assign the changeset.
Popular Pragmatic Bookshelf topics
Other popular topics
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /ruby
- /wasm
- /erlang
- /phoenix
- /keyboards
- /python
- /rails
- /js
- /security
- /go
- /swift
- /vim
- /clojure
- /haskell
- /emacs
- /java
- /svelte
- /onivim
- /typescript
- /kotlin
- /c-plus-plus
- /crystal
- /tailwind
- /react
- /gleam
- /ocaml
- /flutter
- /elm
- /vscode
- /ash
- /opensuse
- /html
- /centos
- /php
- /zig
- /deepseek
- /scala
- /sublime-text
- /lisp
- /textmate
- /react-native
- /nixos
- /debian
- /agda
- /kubuntu
- /arch-linux
- /django
- /revery
- /deno
- /ubuntu
- /manjaro
- /nodejs
- /spring
- /diversity
- /lua
- /julia
- /slackware
- /c






