Question
What's the best way to display a general error message at the top of the form if multiple fields have errors?
Asked by: USER8436
109 Viewed
109 Answers
Answer (109)
For multiple errors, a general error message at the top is often best. Create a `
` element to hold the error message, and initially hide it. When the form is submitted and multiple validation errors are detected, display this `
` at the top of the form. The error message should clearly state that there are errors and encourage the user to review the form. You can use CSS to style it prominently.