I have an ASP.NET MVC Project working with NHibernate and NHibernate.Validator and i'd like to use xVal 1.0 (most recent release). I Added the requested scripts to the project and referenced it in Site.Master:
<script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery-1.3.2.js")%>"></script>
<script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.validate.js")%>"></script>
<script type="text/javascript" src="<%= ResolveUrl("~/Scripts/xVal.jquery.validate.js")%>"></script>
Then I Added the NHibernateValidatorRulesProvider to the xVal.ActiveRuleProviders in the Global.asax Application_OnStart():
xVal.ActiveRuleProviders.Providers.Add(new NHibernateValidatorRulesProvider(ValidatorMode.OverrideXmlWithAttribute));
Finally, on the View, I added:
<%= Html.ClientSideValidation<DomainModel.Entities.MyCustomClass>(Prefix) %>
I get a JavaScript Warning in IE but none in Firefox. If enter now some invalid fields and submit these, xVal does not fire - a PostBack is being made instead and the Serverside validation processes the the data.
What am I doing wrong? I've been able to make the xVal sample Project running with xVal 1.0...
//edit: I have to precise my statement: Something is actually happening: It does a post-back and marks the invalid fields red (as it's doing all the time with the server-side validation) but if i write something into these fields, the color changes back to it's normal state. but if I then delete again the value, nothing is happening until I click Submit and the form does anothe postback... If I remove the clientsidevalidation code, this does not appear to happen.