Knockout-Contrib / Knockout-Contrib/Knockout-Validation
Conditional Validation with Native Rules
- Dominant language
- JavaScript
- Stars
- 1k
- Forks
- 366
- PR merge metrics
- No merged PRs in 30d
Description
Is it possible to use Conditional Validation along with Native Rules? Something like this for example.
```
self.validationObject = ko.validatedObservable({
Name: self.Name.extend({ required: true }),
Type: self.Type.extend({ required: true }),
Description: self.Description.extend({ required: true }),
Price: self.Price.extend({
required:
{
number: true,
onlyIf:
function () {
if (self.Classification() == 0){return false;} else{return true;}
}
}
})
});
```
Contributor guide
Research direction
Start by reproducing the validationObject example from the issue and inspect how Conditional Validation and Native Rules are handled together. Define the expected behavior for the required rule when Classification changes, then verify that the example works without breaking existing validation behavior.
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
- 25/100