Skip to content

Display Ecto Errors for Live Resources #477

Closed Answered by Flo0807
sneha-saj asked this question in Q&A
Discussion options

You must be logged in to vote

You have to add the error under the name of a field you are displaying.

For example, if you have a username field like this

username: %{
  module: Backpex.Fields.Text,
  label: "Username"
},

you need to add the error under the username key to the changeset.

Ecto.Changeset.unique_constraint/3 also has an error_key option, which in this case should be :username.

@sneha-saj

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Flo0807
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants