Custom validation failing with “Cannot read property 'call' of undefined” MVC jquery2019 Community Moderator ElectionValidation failed for one or more entities. See 'EntityValidationErrors' property for more detailsASP.NET MVC: Custom Validation by DataAnnotationMVC unobtrusive validation - Custom validator that depends on a previous selectionASP.NET MVC Custom Validator not triggeringJquery Unobtrusive Validation 'Cannot read property 'type' of undefined'MVC Foolproof validation - Cannot read property 'value' of undefinedHow to customize ASP.net MVC jquery unobtrusive validation message displayWhy do I get periodic Uncaught TypeError: Cannot read property 'value' of undefined when setting the value of multiple dropdownlists?How to validate a list of checkbox through custom jQuery in asp.net mvcCannot read property value of undefined (ASP.NET MVC)

Draw this image in the TIKZ package

How to distinguish easily different soldier of ww2?

Why do we call complex numbers “numbers” but we don’t consider 2-vectors numbers?

Why restrict private health insurance?

What does *dead* mean in *What do you mean, dead?*?

Tool for measuring readability of English text

Did Amazon pay $0 in taxes last year?

Are small insurances worth it?

How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?

Inorganic chemistry handbook with reaction lists

Unfamiliar notation in Diabelli's "Duet in D" for piano

Why isn't P and P/poly trivially the same?

Was this cameo in Captain Marvel computer generated?

Will the concrete slab in a partially heated shed conduct a lot of heat to the unconditioned area?

Having the player face themselves after the mid-game

What can I do if someone tampers with my SSH public key?

Sort array by month and year

Giving a talk in my old university, how prominently should I tell students my salary?

What is Tony Stark injecting into himself in Iron Man 3?

Short story about an infectious indestructible metal bar?

How to educate team mate to take screenshots for bugs with out unwanted stuff

Why does a car's steering wheel get lighter with increasing speed

Do I need a return ticket to Canada if I'm a Japanese National?

How can I portion out frozen cookie dough?



Custom validation failing with “Cannot read property 'call' of undefined” MVC jquery



2019 Community Moderator ElectionValidation failed for one or more entities. See 'EntityValidationErrors' property for more detailsASP.NET MVC: Custom Validation by DataAnnotationMVC unobtrusive validation - Custom validator that depends on a previous selectionASP.NET MVC Custom Validator not triggeringJquery Unobtrusive Validation 'Cannot read property 'type' of undefined'MVC Foolproof validation - Cannot read property 'value' of undefinedHow to customize ASP.net MVC jquery unobtrusive validation message displayWhy do I get periodic Uncaught TypeError: Cannot read property 'value' of undefined when setting the value of multiple dropdownlists?How to validate a list of checkbox through custom jQuery in asp.net mvcCannot read property value of undefined (ASP.NET MVC)










0















I can't for the life of me figure out the problem with this script. I'm doing a custom validation as in this post https://www.codeproject.com/Tips/780992/Asp-Net-MVC-Custom-Compare-Data-annotation-with-Cl



The only thing I changes was some date format handling. See my customcompare.js here:



$.validator.addMethod("genericcompare", function (value, element, params) params.length == 0 );
$.validator.unobtrusive.adapters.add("genericcompare",
["comparetopropertyname", "operatorname"], function (options)
options.rules["genericcompare"] = "#" +
options.params.comparetopropertyname + "," + options.params.operatorname;
options.messages["genericcompare"] = options.message;
);


The error I am getting is : "Uncaught TypeError: Cannot read property 'call' of undefined. Exception occurred when checking element LaycanStartDate, check the 'genericcompare' method"



Model:



[Display(Name = "LaycanStartDate", ResourceType = typeof(Resources.Resources))]
[DataType(DataType.DateTime)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "0:dd/MM/yyyy hh:mm")]
[GenericCompare(CompareToPropertyName = "LaycanEndDate", OperatorName = GenericCompareOperator.LessThanOrEqual, ErrorMessageResourceName = "LaycanStartBeforeEnd",ErrorMessageResourceType = typeof(Resources.Resources))]
public DateTime LaycanStartDate get; set;









share|improve this question
























  • Since you're getting value from the user, running eval on it is quite dangerous.

    – Heretic Monkey
    2 days ago















0















I can't for the life of me figure out the problem with this script. I'm doing a custom validation as in this post https://www.codeproject.com/Tips/780992/Asp-Net-MVC-Custom-Compare-Data-annotation-with-Cl



The only thing I changes was some date format handling. See my customcompare.js here:



$.validator.addMethod("genericcompare", function (value, element, params) params.length == 0 );
$.validator.unobtrusive.adapters.add("genericcompare",
["comparetopropertyname", "operatorname"], function (options)
options.rules["genericcompare"] = "#" +
options.params.comparetopropertyname + "," + options.params.operatorname;
options.messages["genericcompare"] = options.message;
);


The error I am getting is : "Uncaught TypeError: Cannot read property 'call' of undefined. Exception occurred when checking element LaycanStartDate, check the 'genericcompare' method"



Model:



[Display(Name = "LaycanStartDate", ResourceType = typeof(Resources.Resources))]
[DataType(DataType.DateTime)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "0:dd/MM/yyyy hh:mm")]
[GenericCompare(CompareToPropertyName = "LaycanEndDate", OperatorName = GenericCompareOperator.LessThanOrEqual, ErrorMessageResourceName = "LaycanStartBeforeEnd",ErrorMessageResourceType = typeof(Resources.Resources))]
public DateTime LaycanStartDate get; set;









share|improve this question
























  • Since you're getting value from the user, running eval on it is quite dangerous.

    – Heretic Monkey
    2 days ago













0












0








0








I can't for the life of me figure out the problem with this script. I'm doing a custom validation as in this post https://www.codeproject.com/Tips/780992/Asp-Net-MVC-Custom-Compare-Data-annotation-with-Cl



The only thing I changes was some date format handling. See my customcompare.js here:



$.validator.addMethod("genericcompare", function (value, element, params) params.length == 0 );
$.validator.unobtrusive.adapters.add("genericcompare",
["comparetopropertyname", "operatorname"], function (options)
options.rules["genericcompare"] = "#" +
options.params.comparetopropertyname + "," + options.params.operatorname;
options.messages["genericcompare"] = options.message;
);


The error I am getting is : "Uncaught TypeError: Cannot read property 'call' of undefined. Exception occurred when checking element LaycanStartDate, check the 'genericcompare' method"



Model:



[Display(Name = "LaycanStartDate", ResourceType = typeof(Resources.Resources))]
[DataType(DataType.DateTime)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "0:dd/MM/yyyy hh:mm")]
[GenericCompare(CompareToPropertyName = "LaycanEndDate", OperatorName = GenericCompareOperator.LessThanOrEqual, ErrorMessageResourceName = "LaycanStartBeforeEnd",ErrorMessageResourceType = typeof(Resources.Resources))]
public DateTime LaycanStartDate get; set;









share|improve this question
















I can't for the life of me figure out the problem with this script. I'm doing a custom validation as in this post https://www.codeproject.com/Tips/780992/Asp-Net-MVC-Custom-Compare-Data-annotation-with-Cl



The only thing I changes was some date format handling. See my customcompare.js here:



$.validator.addMethod("genericcompare", function (value, element, params) params.length == 0 );
$.validator.unobtrusive.adapters.add("genericcompare",
["comparetopropertyname", "operatorname"], function (options)
options.rules["genericcompare"] = "#" +
options.params.comparetopropertyname + "," + options.params.operatorname;
options.messages["genericcompare"] = options.message;
);


The error I am getting is : "Uncaught TypeError: Cannot read property 'call' of undefined. Exception occurred when checking element LaycanStartDate, check the 'genericcompare' method"



Model:



[Display(Name = "LaycanStartDate", ResourceType = typeof(Resources.Resources))]
[DataType(DataType.DateTime)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "0:dd/MM/yyyy hh:mm")]
[GenericCompare(CompareToPropertyName = "LaycanEndDate", OperatorName = GenericCompareOperator.LessThanOrEqual, ErrorMessageResourceName = "LaycanStartBeforeEnd",ErrorMessageResourceType = typeof(Resources.Resources))]
public DateTime LaycanStartDate get; set;






c# asp.net-mvc unobtrusive-validation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









Sparky

82.6k20151239




82.6k20151239










asked 2 days ago









Evan BarkeEvan Barke

4118




4118












  • Since you're getting value from the user, running eval on it is quite dangerous.

    – Heretic Monkey
    2 days ago

















  • Since you're getting value from the user, running eval on it is quite dangerous.

    – Heretic Monkey
    2 days ago
















Since you're getting value from the user, running eval on it is quite dangerous.

– Heretic Monkey
2 days ago





Since you're getting value from the user, running eval on it is quite dangerous.

– Heretic Monkey
2 days ago












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023370%2fcustom-validation-failing-with-cannot-read-property-call-of-undefined-mvc-jq%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023370%2fcustom-validation-failing-with-cannot-read-property-call-of-undefined-mvc-jq%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко