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

Validation 2 models

未關閉
#591 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
439
分支
172
PR 合併指標
30 天內沒有已合併 PR

描述

### Environment

- Ember Version: 2.18.2
- Ember CLI Version: 2.18.0
- Ember CP Validations Version: 3.5.3

### Steps to Reproduce

I have a form with fields that are in a a component. Is there a way to validate them in the component? Let me try to explain this

//model/customer
```
export default Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
phoneCarrierId: DS.attr('number'),
});
```

//model/settings
```
export default Model.extend({
phoneCarriers: DS.attr('array'),
phoneCarrierRequired: DS.attr('bool')
});
```

// template/customer/index
```
{{#bs-form formLayout="vertical" class="bootstrap-form" novalidate=true model=model.customer onSubmit=(action "saveChanges") as |form|}}
{{form.element
id="firstname"
controlType="text"
label="Your first name"
placeholder="First name"
property="firstName"
required=true
useIcons=false}}

{{form.element
id="lastname"
controlType="text"
label="Your last name"
placeholder="Last name"
property="lastName"
required=true
useIcons=false}}

{{my-component model.customer model.settings}}
{{/bs-form}}
```

So the problem I have is the settings model has something I need for CP validations for customer. So I thought in`my-component` I could setup separate validation. Or is there a better way?

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。