ClientSide Error 'Sys is not defined'

May 8, 2014 at 1:31 PM
I used the package manager console to install these two packages: foolproof & MvcExtentions.Foolproof. I included the foolproof script files in my bundle config (see below).

Note that I didn't implement any foolproof code yet, I only installed the pacakges and included the script files and then ran the app.

I'm getting the following clientside error:

MvcFoolproofValidation.js: Uncaught ReferenceError: Sys is not defined
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js",
                        "~/Scripts/jquery-ui-{version}.js",
                        "~/Scripts/jquery.unobtrusive*",
                        "~/Scripts/jquery.validate*",
                        "~/Scripts/MvcFoolproofJQueryValidation.js",
                        "~/Scripts/mvcfoolproof.unobtrusive.js",
                        "~/Scripts/MvcFoolproofValidation.js"
                        ));
which renders as: (if its of any consequence)
<script src="/Scripts/jquery-1.10.2.js"></script>
<script src="/Scripts/jquery-ui-1.10.3.js"></script>
<script src="/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="/Scripts/jquery.validate.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js"></script>
<script src="/Scripts/MvcFoolproofJQueryValidation.js"></script>
<script src="/Scripts/mvcfoolproof.unobtrusive.js"></script>
<script src="/Scripts/MvcFoolproofValidation.js"></script>
May 15, 2014 at 9:38 AM
Edited May 15, 2014 at 10:32 AM
Hi,
I'm solved it by adding only the "mvcfoolproof.unobtrusive.min.js" to my bundle config:
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js",
                        "~/Scripts/jquery-ui-{version}.js",
                        "~/Scripts/jquery.unobtrusive*",
                        "~/Scripts/jquery.validate*",
                        "~/Scripts/mvcfoolproof.unobtrusive.js",
                        ));
I checked also that if I change the id attribute of a RequiredIf input text, I have a null javascript error.
Jul 1, 2014 at 9:14 PM
@kfmarcov - Thank you for posting this solution, I was really stumped on this 'sys is not defined error'. However, as it appears that the client side validation works perfectly fine with only the mvcfoolproof.unobtrusive.js what are the 'MvcFoolproofJQueryValidation.min.js' and the 'MvcFoolproofValidation.min.js' for? Did these jQuery validators simply support MicrosoftMvcAjax? Just curious if anyone knows. Thanks