[html-formfu] Suppressing error message output?

Carl Franks fireartist at gmail.com
Wed May 6 12:07:27 GMT 2009


2009/5/6 Matthias Dietrich <perl at rainboxx.de>:
> To clear the errors was the only way I found to suppress the error message
> output in front of the labels.  But I guess that also suppresses
> modification of the field classes so that I'm not able to mark the labels
> red by CSS, right?

okay, I suppose you could add this in the get_fields() loop:

    HTML::FormFu::Util::append_xml_attribute(
        $field->container_attributes,
        'class',
        'error',
    );

That'll add the generic 'error' class, which'll give you the
red-backround (using
the "vertically-aligned" example css).
If you also need the class name for each error-type, check out
_render_error_class()
in HTML::FormFu::Element::_Field.pm

> In my opinion it's a much better user experience to have the occurred errors
> in front of the form instead letting the user search through the whole form
> to find the errors.  But I also want to have an indicator near the fields
> saying that this field needs corrections (like a star oder red colored
> label). Clearing the errors will also prevent indicating the fields.

A much cleaner way of doing this would be to add support for it into
the HTML-FormFu core.

Carl



More information about the HTML-FormFu mailing list