adopted-ember-addons / adopted-ember-addons/ember-cp-validations

validation depending on status of other field

Open
#371 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
439
Forks
172
PR merge metrics
No merged PRs in 30d

Description

### Environment
- Ember Version: 2.8.1
- Ember CP Validations Version: 3.0.1
### Steps to Reproduce

I'm trying to validate a dropdown value only if a checkbox is selected. How would I do this:

Model:
export default DS.Model.extend(Validations, {
age_restriction: DS.attr('number', {defaultValue: 0}),
isAgeRestricted: Ember.computed.gt('age_restriction', 0),
});

isAgeRestricted will return a boolean value. I need to validate the age_restriction is greater than zero only if isAgeRestricted is true.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.