-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforcing validatable fields on validationElement and validationMessage seems overkill #519
Comments
I have run into this problem also. I have a code base with On Friday, January 23, 2015, askheaves [email protected] wrote:
John Holliday, Jr. - 2213 W 120th St, Leawood, KS 66209 - 816.210.2184 |
Seems like a good idea to me - currently placing @askheaves Do you think we can have this for |
Running into a couple issues reconciling unit tests between command-line build and browser. Will squash the entire changeset before the pull. |
We are running across a breaking change between knockout.validation 1 and 2 where fields tagged in markup with validationElement or validationMessage are throwing when there are no validation rules attached. This doesn't seem necessary.
Firstly, it forces a coupling between markup and backing .js to ensure any applied rules are accompanied by markup, but absence of rules means a throw.
Second, it complicates creating shared components which may or may not have validated dynamic fields in the absence of an isValidatable utility, which would end up pretty boilerplate anyway.
Our particular case is a property grid, generated by some Asp.Net code. Without coupling the .cs/.cshtml to the backing .js, I'm not sure how to determine when to add the validationElement.
fix would be to remove the 2 instance of:
Though, I can't vouch for what terrible effects that would cause since its introduction in this commit: dba75b6
I'm willing to work a pull request removing this seemingly unnecessary check, if necessary. It feels analogous to the difference between a null collection and an empty collection. Calling code shouldn't need to go through the extra trivia of checking code.
The text was updated successfully, but these errors were encountered: