jwaliszko / ExpressiveAnnotations

Annotation-based conditional validation library.
MIT License
351 stars 123 forks source link

HELP: Clientside not working, no data-val-requiredif attributes #148

Closed ibcoder closed 7 years ago

ibcoder commented 7 years ago

I'm having some difficulty with getting the clientside validation to work on a .net core mvc app. It's hitting my required-if annotation rule server-side. I've started through the debugging suggestions, and I never get to the breakpoint on "computeRequiredIf" I believe because no data-val-requiredif* attributes are getting added to the generated html elements. With the .net core, there's no more global.asax and Application_start to add the ExpressiveAnnotationModelValidatorProvider, but it is working serverside, so maybe that's not the issue. Any thoughts on what I did to cause the omission of attributes?

I'm just using the stock EditorFor helper, and here's the model property definition: [MaxLength(50)] [Display(Name = "Name")] [RequiredIf("shortAnswer3 == 'Yes'", ErrorMessage = "Required if you would like a response.")] public string shortAnswer4 { get; set; }

jwaliszko commented 7 years ago

ASP.NET Core is not yet supported (there is a task created for that).

ibcoder commented 7 years ago

I see. Thank you for the quick reply. Well, it looks like a wonderful library and I hope to use it in the future. Cheers!