Knockout-Contrib / Knockout-Contrib/Knockout-Validation

Keep invalid values out of the viewmodel

Open
#606 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.