I execute the command “mix phx.server” and I get the following errors:
Compiling 15 files (.ex)
warning: undefined function submit/1 (expected App1Web.PageHTML to define such a function or for it to be imported, but none are available)
warning: undefined function text_input/2 (expected App1Web.PageHTML to define such a function or for it to be imported, but none are available)
== Compilation error in file lib/app1_web/controllers/page_html.ex ==
** (CompileError) lib/app1_web/controllers/page_html/home.html.heex:241: undefined function label/2 (expected App1Web.PageHTML to define such a function or for it to be imported, but none are available)
So, from the beginning, it looks like a newly generated project is not ready to handle forms which is disappointing. What must I include and where, to get these functions defined?
The latest version has made some big changes when it comes to writing HTML and for new applications created using the latest phx generators, Phoenix.View has been removed which is likely what caused those undefined function errors you’re seeing.
Unified function components across Controllers and LiveViews
Function components provided by HEEx, with declarative assigns and slots, are massive step-change in the way we write HTML in Phoenix projects. Function components provide UI building blocks, allowing features to be encapsulated and better extended over the previous template approach in Phoenix.View. You get a more natural way to write dynamic markup, reusable UI that can be extended by the caller, and compile-time features to make writing HTML-based applications a truly first-class experience.
New applications (and the phx generators), remove Phoenix.View as a dependency in favor of a new Phoenix.Template dependency, which uses function components as the basis for all rendering in the framework.