2

It looks like there's an issue in MVC 2 RC1 if you want to use jQuery.Validate but not the main Microsoft AJAX - which is 25kb even when gzipped.

According to Phil Haack you're supposed to be able to just include these scripts:

 <script src="/Scripts/jquery-1.3.2.js" type="text/javascript"></script> <script src="/Scripts/jquery.validate.js" type="text/javascript"></script> <script src="/Scripts/MicrosoftMvcJQueryValidation.js" type="text/javascript"> 

Unfortunately in some reorganization they did between Beta and RC - you also now need to include MicrosoftAjax.js which defines the Type prototype functions that are used by MicrosoftMvcJQueryValidation.js (the first line is Type.registerNamespace('Sys.Mvc'); which is defined in MicrosoftAjax.js)

Has anyone already extracted out the necessary code from MicrosoftAjax.js that is needed? I'll have to do it sooner or later but if anyone has already done it that would help a lot!

    2 Answers 2

    6

    Aha!

    Looks like MicrosoftMvcValidation.js is NOT the file needed for jQuery.validate.

    You need to use the very similarly named MicrosoftMvcJQueryValidation.js. This has no dependency on Microsoft.Ajax.js.

    The latest version of MicrosoftMvcJQueryValidation.js is available in the futures download project. It isn't included in the normal download - hence my confusion.

    1
    1

    Instead of jumping through hoops to get this working, you might want to look into letting Microsoft/Google serve the AJAX library for you. This would likely give you a speed advantage. And a good chance that the library will already exist on the client's machine.

    1
    • i already have too many javascript files i need. this is my limit for sure. plus its definitely kind of a bug - albeit easy to fix. plus hopefully people will find this and understand the problem soonerCommentedDec 20, 2009 at 4:31

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.