I get this long warning/error
undefined function label/2 (expected MyAppLiveWeb.BookFormLive to define such a function or for it to be imported, but none are available)Elixir
undefined function text_input/2 (expected MyAppLiveWeb.BookFormLive to define such a function or for it to be imported, but none are available)Elixir
variable “f” does not exist and is being expanded to “f()”, please use parentheses to remove the ambiguity or change the variable nameElixir
variable “f” does not exist and is being expanded to “f()”, please use parentheses to remove the ambiguity or change the variable nameElixir
(CompileError) undefined function f/0 (expected MyAppLiveWeb.BookFormLive to define such a function or for it to be imported, but none are available)
when trying to define a form like this:
def render(assigns) do
~H"""
<h1>Testing the book form</h1>
<.form let={f} for={@form} id="book-form" phx-change="validate" phx-submit="save">
<%= label(f, :title) %> <%= text_input(f, :title) %>
</.form>
"""
end
my question is:
- where are the fields defined in this case
- where can I find example of using forms in the latest version of elixir/phoenix.
It seems the forms declarations seem to change on almost every release.
anywho: thanks
I’m currentlly working with
defp deps do
[
{:phoenix, "~> 1.7.2"},
{:phoenix_ecto, "~> 4.4"},
{:ecto_sql, "~> 3.6"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 3.3"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 0.18.18"},
{:floki, ">= 0.30.0", only: :test},
{:phoenix_live_dashboard, "~> 0.7.2"},
{:esbuild, "~> 0.7", runtime: Mix.env() == :dev},
{:tailwind, "~> 0.2.0", runtime: Mix.env() == :dev},
{:swoosh, "~> 1.3"},
{:finch, "~> 0.13"},
{:telemetry_metrics, "~> 0.6"},
{:telemetry_poller, "~> 1.0"},
{:gettext, "~> 0.20"},
{:jason, "~> 1.2"},
{:plug_cowboy, "~> 2.5"}
]
end