
Pistrie
Programming Phoenix LiveView: What should the Rating form look like? (page 216/217)
Currently the component looks like this:
<div>
<.form :let={f} for={@changeset} phx-submit="save" phx-target={@myself} id={@id}>
<.input field={{f, :user_id}} type="hidden" />
<.input field={{f, :product_id}} type="hidden" />
<.input
field={{f, :stars}}
type="rating"
prompt="Rating"
options={[
"★★★★★": 5,
"★★★★": 4,
"★★★": 3,
"★★": 2,
"★": 1
]}
/>
<.button phx-disable-with="Saving...">Save</.button>
</.form>
</div>
However this gives me the following error:
Long error inside
key :name not found in: %{__changed__: nil, __given__: %{__changed__: nil, field: {%Phoenix.HTML.Form{source: #Ecto.Changeset, valid?: false>, impl: Phoenix.HTML.FormData.Ecto.Changeset, id: "rating-form-1", name: "rating", data: %Pento.Survey.Rating{__meta__: #Ecto.Schema.Metadata<:built, "ratings">, id: nil, stars: nil, user_id: 1, user: #Ecto.Association.NotLoaded, product_id: 1, product: #Ecto.Association.NotLoaded, inserted_at: nil, updated_at: nil}, hidden: [], params: %{}, errors: [], options: [method: "post", id: "rating-form-1", multipart: false, "phx-submit": "save", "phx-target": %Phoenix.LiveComponent.CID{cid: 1}], index: nil, action: nil}, :user_id}, type: "hidden"}, errors: [], field: {%Phoenix.HTML.Form{source: #Ecto.Changeset, valid?: false>, impl: Phoenix.HTML.FormData.Ecto.Changeset, id: "rating-form-1", name: "rating", data: %Pento.Survey.Rating{__meta__: #Ecto.Schema.Metadata<:built, "ratings">, id: nil, stars: nil, user_id: 1, user: #Ecto.Association.NotLoaded, product_id: 1, product: #Ecto.Association.NotLoaded, inserted_at: nil, updated_at: nil}, hidden: [], params: %{}, errors: [], options: [method: "post", id: "rating-form-1", multipart: false, "phx-submit": "save", "phx-target": %Phoenix.LiveComponent.CID{cid: 1}], index: nil, action: nil}, :user_id}, id: nil, inner_block: [], label: nil, multiple: false, prompt: nil, rest: %{}, type: "hidden"}What do I do to fix this?
Marked As Solved

SophieDeBenedetto
Author of Programming Phoenix LiveView
The code in the book is working off of an outdated version of LiveView, and you appear to be using a newer version. You might find some help here Programming Phoenix LiveView: promo form requires "to_form" changes (p133) - #4 by SophieDeBenedetto. We are currently hard at work on an upgraded version of the whole book which will available for download in the next few weeks so stay tuned!
Popular Pragmatic Bookshelf topics

page 20: … protoc command…
I had to additionally run the following go get commands in order to be able to compile protobuf code using go...
New

As per the title, thanks.
New

Hi,
build fails on:
bracket-lib = “~0.8.1”
when running on Mac Mini M1 Rust version 1.5.0:
Compiling winit v0.22.2
error[E0308]: mi...
New

Page 28: It implements io.ReaderAt on the store type.
Sorry if it’s a dumb question but was the io.ReaderAt supposed to be io.ReadAt?
...
New

This isn’t directly about the book contents so maybe not the right forum…but in some of the code apps (e.g. turbo/06) it sends a TURBO_ST...
New

When trying to generate the protobuf .go file, I receive this error:
Unknown flag: --go_opt
libprotoc 3.12.3
MacOS 11.3.1
Googling ...
New

The allprojects block listed on page 245 produces the following error when syncing gradle:
“org.gradle.api.GradleScriptException: A prob...
New

Modern front-end development for Rails, second edition - Struggling to get the first chapter to work
After running /bin/setup, the first error was: The foreman' command exists in these Ruby versions: That was easy to fix: gem install fore...
New

Hello faithful readers! If you have tried to follow along in the book, you are asked to start up the dev environment via dx/build and ar...
New

I just bought this book to learn about Android development, and I’m already running into a major issue in Ch. 1, p. 20: “Update activity...
New
Other popular topics

Reading something? Working on something? Planning something? Changing jobs even!?
If you’re up for sharing, please let us know what you’...
New

What chair do you have while working… and why?
Is there a ‘best’ type of chair or working position for developers?
New

No chair. I have a standing desk.
This post was split into a dedicated thread from our thread about chairs :slight_smile:
New

Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face:
Perhaps if there’s enough peop...
New

Here’s the story how one of the world’s first production deployments of LiveView came to be - and how trying to improve it almost caused ...
New

Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New

I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New

If you want a quick and easy way to block any website on your Mac using Little Snitch simply…
File > New Rule:
And select Deny, O...
New

Author Spotlight:
Bruce Tate
@redrapids
Programming languages always emerge out of need, and if that’s not always true, they’re defin...
New

A Brief Review of the Minisforum V3 AMD Tablet.
Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New
Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /emacs
- /haskell
- /onivim
- /svelte
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /vscode
- /ash
- /opensuse
- /centos
- /php
- /deepseek
- /html
- /scala
- /zig
- /debian
- /sublime-text
- /textmate
- /nixos
- /lisp
- /agda
- /react-native
- /kubuntu
- /arch-linux
- /ubuntu
- /revery
- /manjaro
- /spring
- /django
- /diversity
- /lua
- /nodejs
- /julia
- /c
- /slackware
- /markdown