Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error handling from the <form:errors> tag [SPR-3390] #8073

Closed
spring-issuemaster opened this issue Apr 18, 2007 · 3 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Apr 18, 2007

William Shields opened SPR-3390 and commented

form:errors is a pretty crude mechanism for displaying multiple errors. It uses a default delimieter of <br>. It should allow for more sophisticated methods of displaying errors.

In the simple case, I would like to see "schemes" introduced. For example:

<form:errors path="*" scheme="ul"/>

which would craete:

<ul>
<li>error1</li>
<li>error2</li>
</ul>

Note: if there were no errors the enclosing <ul> tag should not be rendered.

Example schemes could be:

table
ul
ol

Potentially this may require another attribute to distinguish between the CSS class given to the enclosing tags and that given to each element, although if the enclosing tag got the value of cssClass, a CSS selector could resolve that problem without adding an attribute.

In the more complicated example, it is possibly worthwhile (although arguably unnecessary if you have sufficient schemes as defined above) to allow either the programmer to write their own schemes or to have sufficient attributes to achieve the same thing.

Example:

<form:scheme name="errorTable">

form:pre

<table>
<tr>
<th>Error #</th>
<th>Error Description</th>
</tr>
</form:pre>

<form:loop var="count">

<tr>
<td><c:out value="${count}"/></td>
<td><form:error/></td>
</tr>
</form:loop>

form:post

</table>
</form:post>

</form:scheme>

The simple example of this kind of thing would be adding attributes:

<form:errors path="*" block="ul" item="li"/>

alternatively have a heading block within:

<form:errors path="*" block="ul" item="li">

<p>The following errors have occurred:</p>
</form:errors>
Anywa, you get the idea.


Affects: 2.0.4

Issue Links:

  • #13859 Extend form:errors with something like errorElement ("is duplicated by")

20 votes, 14 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 10, 2007

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 10, 2007

Rick Evans commented

Hi William

I agree that form:errors/ is a pretty coarse mechanism for displaying errors. The delimiter between individual errors can now be controlled (see the Javadoc), but it is nowhere near as flexible as you'd like.

I am not going to have enough time to address this myself in the 2.1 timeframe though. I'm going to have to let this one slip to a later release... I guess it needs to accrue more votes before it becomes a priority.

Cheers
Rick

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 12, 2019

Bulk closing outdated, unresolved issues. Please, reopen if still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.