Hi there,
I have problem following this tutorial in Phoenix 1.7 (Create an index page):
mix phx.server
Compiling 1 file (.ex)
warning: undefined function submit/1 (expected VamosWeb.EventsHTML to define such a function or for it to be imported, but none are available)
lib/todo_web/controllers/items_html/index.html.heex:15
warning: undefined function date_input/2 (expected VamosWeb.EventsHTML to define such a function or for it to be imported, but none are available)
lib/todo_web/controllers/items_html/index.html.heex:12
warning: undefined function text_input/2 (expected VamosWeb.EventsHTML to define such a function or for it to be imported, but none are available)
lib/todo_web/controllers/items_html/index.html.heex:9
warning: undefined function text_input/2 (expected VamosWeb.EventsHTML to define such a function or for it to be imported, but none are available)
lib/todo_web/controllers/items_html/index.html.heex:6
== Compilation error in file lib/todo_web/controllers/items_html.ex ==
** (CompileError) lib/todo_web/controllers/items_html/index.html.heex:3: undefined function form_for/3 (expected VamosWeb.EventsHTML to define such a function or for it to be imported, but none are available)
My form:
<h1>Events</h1>
<%= form_for @changeset, Routes.events_path(@conn, :create), fn f -> %>
<label>
Add a new todo item: <%= text_input f, :title %>
</label>
<label>
Add a new todo item: <%= text_input f, :description %>
</label>
<label>
Add a new todo item: <%= date_input f, :date %>
</label>
<%= submit "Submit" %>
<% end %>
<%= for item<- @items do %>
<h3><%= item.description %></h3>
<%= if event.completed do %>
<p style="color:green;">Completed</p>
<% else %>
<p style="color:red;">To be done </p>
<% end %>
<hr>
<% end %>
My items_html.ex:
defmodule TodoWeb.ItemsHTML do
use TodoWeb, :html
embed_templates "items_html/*"
end
Any clue what I’m doing wrong?