ng-dynamic-forms
ng-dynamic-forms copied to clipboard
MarkAsTouched does not work on control
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' } } ) ]; } }), ...
Hello @wiatr0k ,
could you revalidate if this is still an issue? Also please share your version in use.
@wiatr0k Did you ever figure this out? It also does not work for me on version 10.
I was faced with a similar problem and I solved it this way https://github.com/udos86/ng-dynamic-forms/issues/915#issuecomment-660016240