adopted-ember-addons / adopted-ember-addons/ember-cp-validations
Validations are not showing on validate action
- 主要言語
- JavaScript
- スター
- 439
- フォーク
- 172
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
DEBUG: Ember : 3.14.1
index.js:194 DEBUG: Ember Data : 3.13.1
index.js:194 DEBUG: jQuery : 3.4.1
index.js:194 DEBUG: Ember Bootstrap : 2.8.1
index.js:194 DEBUG: Ember Simple Auth : 2.1.0
"ember-cp-validations": "^4.0.0-beta.10",
Validator works as expected, but only when I click on specific field. So If I click submit button without fill any field - there no error notification (but validation return "false" - not valid). In the past versions `this.set('didValidate', true);` - solved this problem.
```
const Validations = buildValidations({
name: {
debounce: 500,
validators: [
validator('presence', true)
]
},
email: {
debounce: 200,
validators: [
validator('presence', true),
validator('ds-error'),
validator('format', {
type: 'email'
})
]
}
});
export default Component.extend(Validations,{
store: service(),
actions: {
reg() {
this.validate().then(({ model, validations }) => {
if (!validations.get('isValid')){return; }
let user = this.get('store').createRecord('user', ...
```
```
{{validated-input model=this valuePath='name' placeholder='name'}}
{{validated-input model=this valuePath='email' placeholder='Email'}}
```
**UPDATE**:
So the problem was in `validated-input.js`, `didValidate` si not computed anymore. Add `didValidate` to each `validated-input` solve problem:
```
{{validated-input model=this valuePath='name' placeholder='name' didValidate=didValidate}}
{{validated-input model=this valuePath='email' placeholder='Email' didValidate=didValidate}}
```
Is this solution is right way to show validations? Thanks!
コントリビューションガイド
評価
この issue はまだ評価されていません。