PDA

View Full Version : ideas on displaying validation errors


lindbird
Aug 26th, 2005, 12:57 PM
I am trying to display a web form with validation on submit, but am having a hard time displaying errors in a neat way. Currently, I am doing it the "spring" way:

<spring:bind path="myCommand.description">
<input type="text" name="${status.expression}" value="<c:out value="${status.value}"/>"/>
<span class="fieldError">${status.errorMessage}</span>
</spring:bind>


the problem occurs when I have multiple inputs on one line, when the validation errors come up, the fields get wrapped to the next line... ahhh

how has anyone dealt with this?

Cowboy Bob
Aug 26th, 2005, 02:03 PM
Hint : you can bind the same property more than once. So this is valid:-

<spring:bind path="myCommand.description">
<input type="text" name="${status.expression}" value="<c:out value="${status.value}"/>"/>
</spring:bind>

<spring:bind path="myCommand.description">
<span class="fieldError">${status.errorMessage}</span>
</spring:bind>

You can then put the error anywhere you want on the page. As to how you design your page, well that's up to you :wink:

Bob