enoonan

enoonan

Programming Phoenix LiveView: Use Schemaless Changesets In Liveview - demo adding @form before opening "/promo"

In this section, at the point where it tells the reader to “Start up the server, log in, and point your browser at /promo… You should see the following: [image of the Promo page]” …

… it hasn’t yet gone through the code where you add the form to the socket assigns. So it causes this error:

key :form not found in: %{
  socket:
  ...

Up to this point the PromoLive module only includes a stubbed out mount function:

  def mount(_params, _session, socket) do
    {:ok, socket}
  end

My suggestion would be either putting the instruction to “Start up the server” etc after the form code has been added, or don’t include the @form in the HEEX markup right off the bat.

EDIT:
So actually, right after the code where the @form gets added to the socket, it says “Now that we’ve created a form…and added it to our socket assigns, let’s render it in our template” and then shows the same HEEX markup as before.

So I think this may just be a case where a section got moved from one spot to another and didn’t get deleted from the original spot.

EDIT 2:
Ok yes. The first image of the Promo page doesn’t even include the form fields, but the second one that comes later does. Further evidence that the @form was just left in that first HEEX bit accidentally.

First Post!

SophieDeBenedetto

SophieDeBenedetto

Author of Programming Phoenix LiveView

Thank you! We will fix this :slight_smile:

Popular Pragmatic topics Top

johnp
Running the examples in chapter 5 c under pytest 5.4.1 causes an AttributeError: ‘module’ object has no attribute ‘config’. In particula...
New
telemachus
Python Testing With Pytest - Chapter 2, warnings for “unregistered custom marks” While running the smoke tests in Chapter 2, I get these...
New
herminiotorres
Hi! I know not the intentions behind this narrative when called, on page XI: mount() |> handle_event() |> render() but the correc...
New
AleksandrKudashkin
On the page xv there is an instruction to run bin/setup from the main folder. I downloaded the source code today (12/03/21) and can’t see...
New
alanq
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
leonW
I ran this command after installing the sample application: $ cards add do something --owner Brian And got a file not found error: Fil...
New
fynn
This is as much a suggestion as a question, as a note for others. Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New
hazardco
On page 78 the following code appears: <%= link_to ‘Destroy’, product, class: ‘hover:underline’, method: :delete, data: { confirm...
New
taguniversalmachine
It seems the second code snippet is missing the code to set the current_user: current_user: Accounts.get_user_by_session_token(session["...
New
a.zampa
@mfazio23 I’m following the indications of the book and arriver ad chapter 10, but the app cannot be compiled due to an error in the Bas...
New

Other popular topics Top

Devtalk
Reading something? Working on something? Planning something? Changing jobs even!? If you’re up for sharing, please let us know what you’...
1017 16965 374
New
brentjanderson
Bought the Moonlander mechanical keyboard. Cherry Brown MX switches. Arms and wrists have been hurting enough that it’s time I did someth...
New
AstonJ
There’s a whole world of custom keycaps out there that I didn’t know existed! Check out all of our Keycaps threads here: https://forum....
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
Exadra37
I am a Linux user since 2012, more or less, and I always use Ubuntu on my computers, and my last 2 laptops have been used Thinkpads, wher...
New
AstonJ
Do the test and post your score :nerd_face: :keyboard: If possible, please add info such as the keyboard you’re using, the layout (Qw...
New
Margaret
Hello everyone! This thread is to tell you about what authors from The Pragmatic Bookshelf are writing on Medium.
1127 25298 747
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New

Latest in PragProg

View all threads ❯