Can't manually validate properties that are not bound
- Dominant language
- TypeScript
- Stars
- 129
- Forks
- 125
- PR merge metrics
- No merged PRs in 30d
Description
**I'm submitting a feature request**
* **Library Version:**
aurelia-validation@1.1.2
**Please tell us about your environment:**
* **Operating System:**
Ubuntu 17.10
* **Node Version:**
8.7.0
* **NPM Version:**
5.4.2
* **JSPM OR Webpack AND Version**
Gulp (Aurelia CLI 0.31.3)
* **Browser:**
all
* **Language:**
TypeScript 2.6.2
**Current behavior:**
`validationController.errors` remains empty after calling `validationController.validate()`, even though the property being validated is invalid, unless the property being validated is used in a binding with `& validateManually` binding behavior.
Demo: https://gist.run/?id=bd62deb898eca7c93a1ed901068090db
* Click submit button.
* Notice how first name isn't validated.
**Expected/desired behavior:**
* **What is the expected behavior?**
It should be possible to validate properties that aren't bound to any element. I'm creating a reusable dropdown editor component. Its value is an array of strings. If I bind that to a hidden element, it becomes a comma-separated list of strings, which is pretty inadequate.
* **What is the motivation / use case for changing the behavior?**
I've been using an ugly workaround where I set aurelia-validation on an unused property bound to a hidden input element and check the desired property directly from within the validation handlers, but it would be much, much better if Aurelia just allowed me to manually validate any property, regardless of binding behavior.
I think the use cases abound. If this behavior is by design and we want to keep it, can we make it configurable at least?
Contributor guide
Research direction
Start with the linked gist and trace validationController.validate(), comparing its behavior with the validateManually binding behavior. The issue names no repository files or tests; done means an invalid unbound property is included in validationController.errors without requiring a hidden-element binding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100