On page 211 there is the following code defining a form:
<.simple_form
for={@form}
phx-change="validate"
phx-submit="save"
id={@id}>
phx-target={@myself} <!-- add this line -->
...
</.form>
The closing bracket for id={@id}>
is wrong and </.form>
should be replaced with </.simple_form>
and the right syntax would rather be:
<.simple_form
for={@form}
phx-change="validate"
phx-submit="save"
id={@id}
phx-target={@myself}<!-- add this line -->
>
...
</.simple_form>
But even with this syntax, the creation of a Demographic still fails with the same error as before:
[error] GenServer #PID<0.1260.0> terminating
** (FunctionClauseError) no function clause matching in PentoWeb.DemographicLive.Form.handle_event/3
(pento 0.1.0) lib/pento_web/live/demographic_live/form.ex:16: PentoWeb.DemographicLive.Form.handle_event("validate", %{"_target" => ["demographic", "gender"], "demographic" => %{"gender" => "female", "year_of_birth" => "2000"}},
...