Undefined attribute "phx_submit" for component Phoenix.Component.form/1

I upgraded to Phoenix 0.18.18 a couple of months ago and had to update my forms to the new form component (see below).

Today I upgraded from Elixir 1.13.2 to 1.15.4 and I’m suddenly getting the following error for ALL of my forms.

warning: undefined attribute "phx_target" for component Phoenix.Component.form/1
  lib/myapp_web/live/author_live/component/find_author.ex:281

warning: undefined attribute "phx_submit" for component Phoenix.Component.form/1
  lib/myapp_web/live/author_live/component/find_author.ex:283

All of my forms are formatted like the code below. I’m getting about 30 warnings because this appears for every single form in my app. It also doesn’t matter what kind of input types are in the form. I get this warning whether the form has text input, select input etc. And the warnings are consistently for phx_change, phx_target and phx_change.

Do I need to add something to make these warnings go away?

<div>
      <.form
        :let={_f}
        for={%{}}
        as={:find_author}
        id="find_author"
        phx_target={@myself}
        phx_change="search"
        phx_submit="submit" >

       ...
     </.form>

The attribute names use hyphens, not underscores.

Try:

phx-change
phx-submit 
phx-validate
2 Likes

:woman_facepalming:

Yep … that was it. And I was incredibly consistent and made that mistake with every single one of my forms. Sigh. I’m kind of surprised it worked this whole time!

Thank you!

3 Likes