adopted-ember-addons / adopted-ember-addons/ember-paper

How to validate on checkbox ?

Đang mở
#969 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
879
Fork
327
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi, I have `checkbox` using `paper-checkbox` and validation form using `ember-cp-validation`, but I get the `form.isInvalid` set to `true` even if I haven't click to checkmark it ?

model

```
import DS from 'ember-data';
import attr from 'ember-data/attr';
import { validator, buildValidations } from 'ember-cp-validations';
import { computed } from '@ember/object';

const { Model } = DS;

const Validations = buildValidations({
premiumType: validator('presence', true),
isAcceptance: validator('presence', true)
});

export default Model.extend(Validations, {
premiumType: attr('string'),
isAcceptance: attr('string')
});
```

template

```
{{#paper-form as |form|}}
{{paper-input label="Premium" value=model.premiumType onChange=(action (mut model.premiumType)) errors=model.validations.attrs.premiumType.messages}}
{{paper-checkbox label="Required" value=model.isAcceptance onChange=(action (mut model.isAcceptance)) errors=model.validations.attrs.isAcceptance.messages}}

{{#form.submit-button disabled=form.isInvalid primary=true raised=true}}
Submit
{{/form.submit-button}}
{{/paper-form}}
```

What I would expect is: the submit button should be Enabled when the validations are valid; but I get the the button already Enabled even if the checkbox has not been checked... Any help?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.