ng-dynamic-forms icon indicating copy to clipboard operation
ng-dynamic-forms copied to clipboard

MarkAsTouched does not work on control

Open wiatr0k opened this issue 6 years ago • 3 comments

I'm submitting a


[x ] Bug / Regression
[ ] Feature Request / Proposal
[ ] Question

I'm using


NG Dynamic Forms Version: `X.Y.Z`

[ ] Basic UI
[ ] Bootstrap UI  
[ ] Foundation UI
[ ] Ionic UI
[ ] Kendo UI
[ ] Material  
[ ] NG Bootstrap
[x ] Prime NG

Description

Hi, it does not work for me called the markAsTouch function on the control. I would like the validations to be displayed after pressing the button but it does not work. Please help me.

Code:

Object.keys(this.formGroup.controls).forEach(field => { const control = this.formGroup.get(field); control.markAsTouched({ onlySelf: false }); });

Model: export const CUSTOMER_DATA_DYNAMIC_MODEL = [ new DynamicFormArrayModel({ id: 'formArray', groupFactory: () => { return []; } }), new DynamicFormArrayModel({ id: 'driverNoReqInputFormArray', initialCount: 0, groupFactory: () => { return [ new DynamicInputModel({ id: 'driverNoReqInput', label: 'Numer prawa jazdy', maxLength: 50, placeholder: 'Numer prawa jazdy', validators: { required: null }, errorMessages: { required: '{{ label }} jest wymagane' } }, { element: { label: 'ui-widget' }, grid: { host: 'ui-g-4 ui-sm-12' } } ) ]; } }), ...

wiatr0k avatar Apr 30 '18 13:04 wiatr0k

Hello @wiatr0k ,

could you revalidate if this is still an issue? Also please share your version in use.

Karamuto avatar Aug 06 '18 19:08 Karamuto

@wiatr0k Did you ever figure this out? It also does not work for me on version 10.

steverhoades avatar Dec 14 '19 18:12 steverhoades

I was faced with a similar problem and I solved it this way https://github.com/udos86/ng-dynamic-forms/issues/915#issuecomment-660016240

fatihsinanyaman avatar Jul 17 '20 10:07 fatihsinanyaman