Client side validation with Jquery - MVC C# app

290 Views Asked by At

I am working on a very LEGACY ASP.NET MVC app using C# which is built from 2009. They don't have any client side validation at all. In other words, they don't use validation mechanism provided by the ASP.NET MVC framework as the following link

https://learn.microsoft.com/en-us/aspnet/core/mvc/models/validation?view=aspnetcore-5.0#client-side-validation

They use service, interface etc... to do validation. Not using data annotations, either. As a result, they don't have unit tests for model validator. All validation rules will be tested manually through server side only or the unit tests have strong dependency to Resource.resx or other services which I don't think they are unit tests.

Therefore, I have added a client side validation and server-side validation by using data anotations.

Unfortunately, my PR is declined because they said that they don't want to use or add jQuery to the current application.

The reason is that: "they want to build portable micro-frontends pointing at APIs rather than all encompassing large applications the current app. because of that jQuery Validate is at the complete opposite end of the scale from zero compromise. It can be done by HTML5 and plenty of other client side only JS libraries there are plenty of better compromises. The other end of the scale (our ideal) is the validation happens in an encapsulated web component that uses Angular Forms." (An answer from a Front end developer)

The problem is that we have not the plan to replace that legacy app yet and I don't see the reason why I cannot use Validation mechanism from Microsoft to do both client side and server side validation. My thought is that it is better to do validation in correct way, rather than let it be bad and will be replaced by web-component soon.

Based on the source code, I am not sure they are able to apply proper validation way in new technology because with the ASP.NET MVC app, I think they did not apply correctly or I don't think they understand the framework.

Any ideas why I should not use jQuery for MS's validation on a legacy app?

Thanks

0

There are 0 best solutions below