# Programming Phoenix LiveView B9.0: Form code syntax does not work as written (p. 198)

**URL:** <https://forum.devtalk.com/t/programming-phoenix-liveview-b9-0-form-code-syntax-does-not-work-as-written-p-198/115084>\
**Category:** PragProg Customers\
**Tags:** book-programming-phoenix-liveview, errata\
**Created:** [3 July 2023 07:52 UTC](https://forum.devtalk.com/t/programming-phoenix-liveview-b9-0-form-code-syntax-does-not-work-as-written-p-198/115084 "2023-07-03T07:52:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![arcanemachine](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/a/e0b2c6/32.png) [@arcanemachine](https://forum.devtalk.com/u/arcanemachine)\
**Post date:** [3 July 2023 07:52 UTC](https://forum.devtalk.com/t/programming-phoenix-liveview-b9-0-form-code-syntax-does-not-work-as-written-p-198/115084/1 "2023-07-03T07:52:57Z")

</div>

This is an identical issue to the one I described in in [this thread](https://forum.devtalk.com/t/programming-phoenix-liveview-b9-0-the-promo-live-view-section-does-not-work-without-modification-when-using-phoenix-1-7-3-and-liveview-0-19-0-p-130/114772).

On page 198, the survey form LiveComponent is described using a syntax that appears to no longer work. The workaround is simple, but as mentioned in the other thread, the live view code may need to be revamped to work with current LiveView best practices.

To implement the easy workaround, modify the `field` attribute in the following file to use the syntax shown in [the current LiveView docs](https://hexdocs.pm/phoenix_live_view/Phoenix.Component.html).

###### `lib/pento_web/live/demographic_live/form.html.heex`

Change this:

```elixir
<.input
  field={{f, :gender}}
  type="select"
  label="Gender"
  options={Pento.Survey.Demographic.gender_options()}
/>
<.input
  field={{f, :year_of_birth}}
  type="select"
  label="Year of birth"
  options={Enum.reverse(1900..2023)}
/>

```

To this:

```elixir
<.input
  field={f[:gender]}
  type="select"
  label="Gender"
  options={Pento.Survey.Demographic.gender_options()}
/>
<.input
  field={f[:year_of_birth]}
  type="select"
  label="Year of birth"
  options={Enum.reverse(1900..2023)}
/>

```

---

<div class="post-metadata">

**Author:** ![arcanemachine](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/a/e0b2c6/32.png) [@arcanemachine](https://forum.devtalk.com/u/arcanemachine)\
**Post date:** [3 July 2023 08:00 UTC](https://forum.devtalk.com/t/programming-phoenix-liveview-b9-0-form-code-syntax-does-not-work-as-written-p-198/115084/2 "2023-07-03T08:00:13Z")

</div>

Bonus error: The options for the `year_of_birth` select field on page 199 (`1920..2023`) do not match the options described in the `Demographic`’s core logic on page 166 (`1900..2022`).

---

<div class="post-metadata">

**Author:** ![SophieDeBenedetto](https://forum.devtalk.com/user_avatar/forum.devtalk.com/sophiedebenedetto/32/2521_2.png) [@SophieDeBenedetto](https://forum.devtalk.com/u/SophieDeBenedetto)\
**Post date:** [7 August 2023 19:13 UTC](https://forum.devtalk.com/t/programming-phoenix-liveview-b9-0-form-code-syntax-does-not-work-as-written-p-198/115084/3 "2023-08-07T19:13:56Z")

</div>

Thanks for sharing this. We’re working on a new version of the Beta book right now and it will be out in a few weeks. This and all other forms will be updated.
