Completely agree with Frederick's initiative to clean this up.
Letting the form builder control the error markup is appropriate. A
default configuration that renders a shared partial for errors might
be a good approach -that would allow customization of layout without
customization of code.
Oth
The insertion of the div only when errors are present is a real pain.
It would be a lot easier to write CSS to style the forms if the div
(or span) was there even when there weren't errors, and then changed
class depending on whether there was an error. I don't think div vs
span is a big