
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 Prag Prog topics










Other popular topics










Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /opensuse
- /rust
- /kotlin
- /ruby
- /erlang
- /python
- /clojure
- /react
- /quarkus
- /go
- /vapor
- /react-native
- /v
- /wasm
- /django
- /security
- /nodejs
- /centos
- /rails
- /haskell
- /fable
- /gleam
- /js
- /swift
- /deno
- /tailwind
- /assemblyscript
- /laravel
- /symfony
- /phoenix
- /crystal
- /typescript
- /debian
- /adonisjs
- /julia
- /arch-linux
- /svelte
- /spring
- /c-plus-plus
- /preact
- /flutter
- /actix
- /java
- /angular
- /ocaml
- /zig
- /kubuntu
- /scala
- /zotonic
- /vim
- /rocky
- /lisp
- /html
- /keyboards
- /emacs
- /nim
- /vuejs
- /nerves
- /elm