Would you recommend creating custom validation attribute (inherits from the IClientValidatable and ValidationAttribute) ?
Basically, we would place these custom attributes over properties in the application layer on the DTOs. These attribute would point to a javascript file on the Web layer that implements the rule via jquery.validator.unobtrusive.adapters.
If we go through with this, where would you recommend we place these custom annotations class? They will both validate information on the application layer and on the web layer.
Thanks in advance
We are developing complex forms with many complex business rules such as "FieldY" should be required if FieldX is true and FieldZ is equal to 1 or 2.
From what I understand, validation should be applied on DTO's on the application layer and the cshtml should implement specific attribute on the HTML inputs to render the validation...However in the case of more complex validation rules I cannot figure out how to render the error per field on the view.
Currently the validation is displayed in a modal window after submission of my modal but I cannot show the validation error on the field itself (with a red border)
What are my options ? Should I add unobtrusive validation and create custom data annotation that implement the IClientValidatable? If so where should I place them to follow the best practices?
Thanks in advance