adopted-ember-addons / adopted-ember-addons/ember-cp-validations
Validation 2 models
- Lingua principale
- JavaScript
- Stelle
- 439
- Fork
- 172
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### 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?
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.