xVal client-side not working properly for me

Jul 13, 2009 at 5:16 PM
Edited Jul 13, 2009 at 6:00 PM

EDIT: Nevermind.  The issue seems to be with Firefox (I am using version 3.5).  The page works perfectly in IE7.  I'm leaving the rest of this in case somebody else has the same issue and does a search.

Basically, its seems as though the Html.ClientSideValidation() is not grabbing all the validation attributes properly.  In my sample I have 3 properties and 4 attributes.  The ClientSideValidation() only notices that one of the properties is an int.  And even though it notices that it does nothing to validate it on the client-side.

I basically followed the tutorial on http://blog.codeville.net/2009/01/10/xval-a-validation-framework-for-aspnet-mvc/.

In my case I am using the Data Annotation Model Binder found here: http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24471.  The server-side validation works fine.

I'm not sure what to look for in trying to solve this.  Amy ideas?

 

Coordinator
Jul 13, 2009 at 7:55 PM

You must be using an old version of xVal (0.5?) that was released before ASP.NET MVC 1.0.

Please upgrade to a newer version of xVal (i.e., 0.8 or a more recent source code build), and then it will work properly with ASP.NET MVC 1.0 on all browsers.

Thanks

Jul 14, 2009 at 9:30 PM

I did have an older version of xVal and so I updated.  However, on Firefox 3.5 the client-side validation is still not working properly.

To test this I used the sample application on your blog (BookingsDemo) and updated the xVal assembly to 0.8.  Client-side validation works fine in IE7 but still doesnt work for me in Firefox (running in "safe-mode" to ensure no add-ons were affecting this).  A co-worker ran it on his system using Firefox 3.0.

It late in the day where I'm at so I'll work with this more tomorrow... I'll let you know if I find anything.

Jul 15, 2009 at 1:41 PM
Edited Jul 15, 2009 at 1:42 PM

After further research I still don't really know what my issue is.  However, its clearly not xVal issue.

I downloaded IE8 so I could use its debugger and compare to what I was getting in Firebug.  However, the client-side validation wasn't occuring in IE8 now.  Debugging finally led me to this see this:  for whatever reason the elemId was returning "booking.ClientName" instead of "booking_ClientName".  Since there was no "booking.ClientName" on the page the resulting elem search returned a null, thus not actually applying any rules.

A co-worker sent me his entire BookingClient project and when I ran it everything worked.

So apparently I made some sort of change somewhere in the original project but I'm not entirely sure what it was.  I'll do some Diffs against the two projects to see if I can see what I altered that would cause the underscore to change to a dot.