Using phx 1.6, in .heex
:
<.form let={f} for={@changeset}, phx-change="validate", phx-submit: "add_match_result">
<%= inputs_for f, :embed, fn ff -> %>
<div class="mb-4">
<%= label ff, :name1 %>
<%= text_input ff, :name1, class: "form-control" %>
<%= error_tag ff, :name1 %>
</div>
<div class="mb-4">
<%= label ff, :name2 %>
<%= text_input ff, :name2, class: "form-control" %>
<%= error_tag ff, :name2 %>
</div>
<% end %>
<%= submit "Check it" %>
</.form>
I get the error no route found for POST
which for me means that the form make a post request, and not through the web socket. However, the layout is using the liveview render.
I also tried to "#"
and phx_target: @myself
but nothing have worked as expected. To conclude, the form is inside a <%= for user <- @users do %>
which for me is not a big deal.
As mentioned here Form bindings — Phoenix LiveView v0.16.0 the form should be alright.
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 0.16.0"},
Best Regards, ykostov