PhoenixLive 0.17.5 form tag issue

I’ve found that opening form is closed immediately without body between <.form> … </.form>

<.form let={f} for={:data} phx-change="validate" phx-submit="save" phx-target={@myself.cid} >
    <%= label f, :name %>
    <%= text_input f, :name %>
    <%= error_tag f, :name %>
    <%= submit "Save" %>
  </.form>

Produces

<form action="#" method="post" id="service_formvvdfdf" phx-change="validate" phx-submit="save" phx-target="4"></form>
<label ....
<input ....
<button submit ....

So why form does not include all other tags before is closed ?

It looks like it’s showing all the tags… Except the error, which makes sense because the form hasn’t been validated yet.

I’ve updated first post…

It seems that it has been opened and closed immediately

<form ....> </form>

That confuses me, if I put same form in heex of another component, than I can submit whole form. However, if I edit HTML code inside browser and move < /form > after < button type=submit > I can submit data to server.

Found issue, show the modal must be in the correct place instead of separate div in the code.

1 Like