admin管理员组

文章数量:1392094

I downloaded MVC Fool Proof Validation from /

Beacuse I am in need of [RequiredIf].

When I installed MVC Fool Proof Validation I recieved three Javascript files

which are these that I am using inside my layout:

<script src="@Url.Content("~/Scripts/mvcfoolproof.unobtrusive.min.js")" type="text/javascript"></script>    
<script src="@Url.Content("~/Scripts/MvcFoolproofJQueryValidation.min.js")" type="text/javascript"></script>  
<script src="@Url.Content("~/Scripts/MvcFoolproofValidation.min.js")" type="text/javascript"></script>

Problem is that when I check my scripts with Chrome I get the following errors on these these JS files.

   Uncaught TypeError: Cannot read property 'adapters' of undefined mvcfoolproof.unobtrusive.min.js:54
   Uncaught TypeError: Cannot read property 'ValidatorRegistry' of undefined MvcFoolproofValidation.min.js:50

This is the error on the first one

Second error:

I have not even edited anything inside the JS files :S Any solutions is appreciated!

Thanks in advance!

I downloaded MVC Fool Proof Validation from http://foolproof.codeplex./

Beacuse I am in need of [RequiredIf].

When I installed MVC Fool Proof Validation I recieved three Javascript files

which are these that I am using inside my layout:

<script src="@Url.Content("~/Scripts/mvcfoolproof.unobtrusive.min.js")" type="text/javascript"></script>    
<script src="@Url.Content("~/Scripts/MvcFoolproofJQueryValidation.min.js")" type="text/javascript"></script>  
<script src="@Url.Content("~/Scripts/MvcFoolproofValidation.min.js")" type="text/javascript"></script>

Problem is that when I check my scripts with Chrome I get the following errors on these these JS files.

   Uncaught TypeError: Cannot read property 'adapters' of undefined mvcfoolproof.unobtrusive.min.js:54
   Uncaught TypeError: Cannot read property 'ValidatorRegistry' of undefined MvcFoolproofValidation.min.js:50

This is the error on the first one

Second error:

I have not even edited anything inside the JS files :S Any solutions is appreciated!

Thanks in advance!

Share Improve this question edited Apr 3, 2012 at 8:59 Obsivus asked Apr 3, 2012 at 8:37 ObsivusObsivus 8,35913 gold badges56 silver badges98 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

Looks like you included the scripts before you include jQuery. You should include jQuery before these scripts

Be careful using FoolProof RequiredIf in MVC4.

This works: [RequiredIfTrue("lead_remendation", ErrorMessage="required")]

This does not: [RequiredIfTrue("lead_remendation", ErrorMessage="Required")]

I spent hours racking my brain on this.

Do the below steps:

  • Step 1:

PM> Install-Package MicrosoftAjax

  • Step 2:

PM> Install-Package MicrosoftMvcAjax.Mvc5

  • Step 3:

Include them in bundleconfig like below:

bundles.Add(new ScriptBundle("~/bundles/mvcFoolProof").Include(
                          "~/Scripts/MicrosoftAjax*",
                          "~/Scripts/MicrosoftMvcAjax*",
                          "~/Scripts/MicrosoftMvcValidation*",
                          "~/Scripts/mvcfoolproof*",
                          "~/Scripts/MvcFoolproofJQueryValidation*",                                            
                          "~/Scripts/MvcFoolproofValidation*"));

Now it should work without any errors.

本文标签: javascriptMVC fool proof validation error inside the JS filesStack Overflow