Programming Phoenix LiveView B7: Page 183

After adding in the handle_event function for “save” as defined on page 183 and retrying the survey form, I found that it still fails when I select a date from the dropdown due to:

[error] GenServer #PID<0.620.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:24: PentoWeb.DemographicLive.Form.handle_event("validate", %{"_target" => ["demographic", "gender"], "demographic" => %{"gender" => "female", "user_id" => "5", "year_of_birth" => "1970"}},
...

So to fix this I just added another handle_event matching what was done for “save” but for “validate”. A handler for “validate” should be included in the text somewhere.

Will fix, thanks.