Hi, i have some issues with the default rails error wrapping. It wraps
errors in a div with class ‘fieldsWithError’, which is not good practice
in my eyes. Adding a class ‘error’ to the field would be much nicer.
My solution to the problem: build your own FormBuilder. Funny enough, i
found no (nice) possibility to switch error wrapping off while using the
FormHelper methods. As error_wrapping is a method in InstanceTag (and
not of FormHelper), it is pretty hard to have a FormBuilder change its
One possibility is to define
def initialize(object_name, object, template, options, proc)
ActionView::Base.field_error_proc = lambda do |html_tag, instance|
super(object_name, object, template, options, proc)
which works, but i consider it an unclean solution (as it would change
the error_proc for the whole interpreter run). Consider the case where i
use another proc for my fields but the above version of the proc for my
form - the above version would change the behaviour of all following
Another version would be to redefine InstanceTag.error_wrapping to be
empty with the same method (not nice, eighter - same Argument).
Is there a nice way to have InstanceTags ignore errors (like
:ignore_errors => true) so that i can implement them myself (a trivial
problem inside a FormBuilder). I searched the code, but I find no
convinient way. Any hints would be much appreciated.
Thanks in advance
P.S.: Optional question: Is there a plugin that handles forms like Agavi
( www.agavi.org )? Aside from it being a PHP Framework (yuk!), I do
really like the form processing by filtering the output instead of doing
it explicitly with builders. Customizing forms in rails still seems to
be a bit of work to me :/.