Make sure to pass an id for multiple inputs_for for the same entity
You can use multiple inputs_for
for the same entity, just make sure to pass ids to ensure that Phoenix can diff the fields correctly.
# some-file.ex
def render(assigns) do
~H"""
<.form for={@user_changeset} let={f} %>
<%= inputs_for f, :friend, fn friend -> %>
<!-- ... -->
<% end %>
<!-- ... -->
<%= inputs_for f, :friend, [id: "secondary-friend-input"], fn friend -> %>
<!-- ... -->
<% end %>
<% end %>
"""