Using Html.ValidationMessage in xVal 1.0

Nov 5, 2009 at 11:18 PM


Is there a way I can use <%=Html.ValidationMessage() %> in xVal 1.0?

I'm testing this out on the BookingsDemo but the error messages seem to appear next to the element where the validation has failed instead of in the Html.ValidationMessage which was also defined.


Your name: <%= Html.TextBox("booking.Name") %><%= Html.ValidationMessage("booking", "name") %>

In this case xVal puts the error message just next to the booking.Name textbox. Here I do have the validation message next to the textbox but there are times when I want to move it away from it, or line up the validation messages using a table or something.

What I am trying to do ultimately is to have not just the error message but also an image displayed next to the error. Ive read the easiest way to do this is to redefine the field-validation-error CSS class to include a background image? In any case it would be nice to have control over where the message is displayed.