Create and Display Error Message

Hi guys,

I created a form in Dash where the user inputs data and can store it in a database. Now I’d like to display an error message when the user tries to insert invalid data. What would be the best way to do this?

Some options I’m looking at:

  • Abuse the ConfirmDialog component for this.
  • Create a div. (The div would have to be removed again after x seconds)
  • Use Flask Flashing (It seems this is not supported though)

Any advice would be much appreciated!


Hi Martijn,

Have you figured out which solution works best for you? Either the ConfirmDialog or creating a div? Or perhaps a different approach?


Back then I used a Div which I removed again after x seconds. (You have to write an extra callback for the removal)

Now I’d recommend using an alert: which automatically handles the dismissing for you and has some customization options.

1 Like