Stripes

Ordering of field validation errors

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.4.2
  • Fix Version/s: None
  • Component/s: Formatting
  • Labels:
    None

Description

<stripes:errors/> tag should render validation errors in order that reflects the order of form fields, or at least the order in which the validation errors have been added to the ValidationsErrors collection.

The second step would be to give users complete control over the ordering of rendered field errors. That would require an extension of the validation related annotations with some sort of an 'order' attribute which would hint the framework the order in which validations should be applied.

Another related thing I bumped into:

I would also propose adding fieldErrorsOnly to the errors tag so as to allow users to render global errors and field errors separately. Currently the errors tag supports only the globalErrorsOnly attribute which is great, but I think a complementary attribute would be useful too.

I have just only started with the framework so I do not have any patches nor can I tell whether the above ideas are in line with what you intend to do and how, but hopefully some of the ideas might be usable.

Thanks,
Jan

Activity

Hide
Stefano Zuccaro added a comment - 08/Jan/08 9:20 AM

I propose to make public and replaceable by configuration the inner private Comparator class net.sourceforge.stripes.tag.ErrorsTag.ErrorComparator.

A custom implementation could sort by numeric index a subclass of SimpleError created with an integer parameter at construction time.

I've used this trick to show error messages prefixed by an integer in the error list on the top of the form page; the integer is put also near the relative field in the form with a custom TagErrorRenderer.

Thanks,
Zk

Show
Stefano Zuccaro added a comment - 08/Jan/08 9:20 AM I propose to make public and replaceable by configuration the inner private Comparator class net.sourceforge.stripes.tag.ErrorsTag.ErrorComparator. A custom implementation could sort by numeric index a subclass of SimpleError created with an integer parameter at construction time. I've used this trick to show error messages prefixed by an integer in the error list on the top of the form page; the integer is put also near the relative field in the form with a custom TagErrorRenderer. Thanks, Zk

People

Vote (1)
Watch (1)

Dates

  • Created:
    03/Apr/07 1:26 AM
    Updated:
    19/Jan/08 2:47 PM