I try to use LessThanOrEqualTo from Foolproof version 0.9.4518 compare and validate int from another property, and it is not working.
however, it works for datetime format just like the example.
Here is my code:
model:
public partial class TryFoolProof {
public int max { get; set;}
[LessThanOrEqualTo("max")]
public int? min{ get; set; }
}
I have the script file included in the view:(somehow, NuGet didnt include)
<script src="../../Scripts/jquery.js" type="text/javascript"></script>
<script src="~/Scripts/mvcfoolproof.unobtrusive.min.js"></script>
<script src="~/Scripts/MvcFoolproofJQueryValidation.min.js"></script>
<script src="~/Scripts/MvcFoolproofValidation.min.js"></script>
here is the error:
mvcfoolproof.unobtrusive.min.js:1 Uncaught TypeError: Cannot read property 'addMethod' of undefined
at mvcfoolproof.unobtrusive.min.js:1
at mvcfoolproof.unobtrusive.min.js:1
MvcFoolproofJQueryValidation.min.js:1 Uncaught TypeError: Cannot read property 'addMethod' of undefined
at MvcFoolproofJQueryValidation.min.js:1
MvcFoolproofValidation.min.js:1 Uncaught ReferenceError: Sys is not defined
at MvcFoolproofValidation.min.js:1
so how can I get it work for int?
Thanks
The scripts needed for client side validation using foolproof are, in order
jquery-{version}.js
jquery.validate.js
jquery.validate.unobtrusive.js
mvcfoolproof.unobtrusive.js
and you need to delete /MvcFoolproofJQueryValidation.min.js
and MvcFoolproofValidation.min.js
In particular, you did not include jquery.validate.js
so there is no validator to add the rules to.