1

I installed Fool-Proof from nuGet, but its not working uncaught errors.

Install-Package foolproof -Version 0.9.4518

As I installed it, new folder with name Clients Scripts gets added in to my project with three libraries: FoolProof Unobtrusive, FoolProof jQuery Validation and FoolProof Validation. Then I create new bundle in bundle.config and linked with my shared layout.

    public bool active { get; set; }

    [RequiredIf("active", true,ErrorMessage = "Code is Required")]
    public int Code { get; set; }

It's not displaying validation message. Now, when I checked my console I am getting following errors:

enter image description here

John Adam
  • 220
  • 2
  • 14

1 Answers1

0

You haven't loaded required js files. Add the following in BundleConfig.js

bundles.Add(new ScriptBundle("~/bundles/mvcfoolproof").Include(
            "~/Scripts/MicrosoftAjax.js",
            "~/Scripts/MicrosoftMvcAjax.js",
            "~/Scripts/MicrosoftMvcValidation.js",
            "~/Client Scripts/mvcfoolproof.unobtrusive.min.js",
            "~/Client Scripts/MvcFoolproofJQueryValidation.min.js",
            "~/Client Scripts/MvcFoolproofValidation.min.js"));

and then include in your View in correct order

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/mvcfoolproof")
Mohsin
  • 692
  • 1
  • 7
  • 15