Knockout-Contrib / Knockout-Contrib/Knockout-Validation
Keep invalid values out of the viewmodel
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 366
- PR merge metrics
- No merged PRs in 30d
Description
My viewmodels have a bunch of numeric values, and some summary calculations based on the numeric values. I am using the appropriate numeric validation rules. Problem is, if the user enters non-numeric data, it gets into my viewmodel with undesirable impact on my calculations.
I would like to propose that the "validatable" extender be changed so that it wraps the model's observable with a pure computed. By doing this, it could intercept invalid entries and not allow them to be written to the model.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the validatable extender and reading how it currently wraps model observables and applies numeric validation. Define the behavior so non-numeric entries do not reach the viewmodel or affect summary calculations, then add or update tests covering invalid numeric input and valid values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100