I have a simple schema with an array of strings: field :examples, {:array, :string}
but I have validation errors that I want to display per input, but I don’t see a way to do this with Phoenix.HTML.Form
and Ecto.Changeset
.
inputs_for
only works with embeds and associations, not simple lists, and Ecto.Changeset
only seems to be able to add errors for the general field, not elements in the list.
To get around this, I created a form module with embeds_many
, but it’s less than ideal, because I have to copy data back and forth between the form struct and the actual model struct.