Skip to content

Conversation

@rschiefer
Copy link

Refactored EqualTo validator by pulling common comparison validation code to an abstract base class and added GreaterThan validator based upon the base.

Note: I added a GreaterThan jQuery validator to support the DataAnnotation validator. These need to be added to the NuGet package:

jquery.validate.additional-methods.js
jquery.validate.unobtrusive.additional-methods.js

@srkirkland
Copy link
Owner

Thanks for the code -- it looks really solid but I am hesitant to pull it into the project just yet because of the requirement to add the two additional JavaScript files, while all of the other validators will just work out of the box. I would eventually like to move in this direction and add more complex validators which require custom JavaScript, but I'm not sure how to communicate that to the user. Something like `[DataAnnotationsExtensions.AdditionalValidators.GreaterThan] might work, but seems a bit obtuse, and also I thought about having the "additional validation" validators like yours not initialized (on the client) by default so the user has to turn them on and thus know to add in the proper javascript. Anyway, let me know what you (the wider DataAnnotationsExtensions users) think, because eventually validators like Greater/Less Than, RequiredIf, Future/Past, etc, would be quite helpful but require more user intervention.

@rschiefer
Copy link
Author

Thanks for the kind words and creating this project! At this point it looks like you have covered all the "out-of-the-box" validators so isn't it time to start building custom validators :). I will be using this project (even if only in a local repo) for all my custom validators going forward. It is a far cleaner solution and abstraction point for all my apps to use instead of littering each app or each view with custom validators.

The un-initialized "AdditionalValidators" pattern is already a well known in my opinion because jQuery.Validation does the same.

@rschiefer rschiefer closed this Oct 13, 2011
@rschiefer
Copy link
Author

I merged to your latest code today and would like to avoid this in the future. Can we revisit pulling my additions into your source?

@rschiefer rschiefer reopened this Mar 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants