ryanelian / aspnet-validation

Enables ASP.NET MVC client-side validation without jQuery!
MIT License
40 stars 13 forks source link

Some feature lacking #3

Closed ryhled closed 6 years ago

ryhled commented 6 years ago

Hi! Nice initiative (too bad no official native implementation exists).

Anyway i tested it and had a couple of issues worth mentioning.

1: Remote validation does not seem to support POST. For example:

[Remote("EmailAvailable", HttpMethod = nameof(HttpMethod.Post), AdditionalFields = "__RequestVerificationToken"]

This configuration will result in a GET request clientside which then (naturally) returns a 404 since the action is POST only (and also requires antiforgerytoken).

2: The validation is triggered during typing. It would be nice have the option of switching to same behavior as the original library (which means it does not validate until you leave the field the first time). Looked briefly but couldnt see an option for this.

Anyway keep up the good work :).

ryanelian commented 6 years ago

Interesting issues. I'll look into them.

ryanelian commented 6 years ago

Solved the first one. Now THAT was very interesting. Found bugs in the official library when doing it. (Official library fails when adding AdditionalFields = "__RequestVerificationToken" in a Razor Page nested class / object)

Proud to say that mine works in Razor Pages 😉

However, the second one actually validates as-you-type, when using the official library. So, wontfix.

ryanelian commented 6 years ago

Published 0.0.5 on npm / unpkg.