Reputation: 8359
I downloaded MVC Fool Proof Validation from http://foolproof.codeplex.com/
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!
Upvotes: 4
Views: 4277
Reputation: 21
Do the below steps:
PM> Install-Package MicrosoftAjax
PM> Install-Package MicrosoftMvcAjax.Mvc5
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.
Upvotes: 1
Reputation: 400
Be careful using FoolProof RequiredIf in MVC4.
This works: [RequiredIfTrue("lead_recommendation", ErrorMessage="required")]
This does not: [RequiredIfTrue("lead_recommendation", ErrorMessage="Required")]
I spent hours racking my brain on this.
Upvotes: 1
Reputation: 5100
Looks like you included the scripts before you include jQuery. You should include jQuery before these scripts
Upvotes: 3