From 27e92ad7d8005788e87d31bbf3abd99b1720087a Mon Sep 17 00:00:00 2001 From: Alexey Romanoff Date: Thu, 9 Jun 2022 12:21:53 +0300 Subject: [PATCH 1/2] fix(ajsf/core): json-schema-form service: updateValue: fix validation updateValue: mark as dirty before setting the value in order to run validation Fixes #315 --- projects/ajsf-core/src/lib/json-schema-form.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/ajsf-core/src/lib/json-schema-form.service.ts b/projects/ajsf-core/src/lib/json-schema-form.service.ts index a20eaa77..1d8b45e0 100755 --- a/projects/ajsf-core/src/lib/json-schema-form.service.ts +++ b/projects/ajsf-core/src/lib/json-schema-form.service.ts @@ -650,8 +650,8 @@ export class JsonSchemaFormService { // Set value of current control ctx.controlValue = value; if (ctx.boundControl) { - ctx.formControl.setValue(value); ctx.formControl.markAsDirty(); + ctx.formControl.setValue(value); } ctx.layoutNode.value = value; From 6d347d234b20a6d828a2114e0368746543a0a05d Mon Sep 17 00:00:00 2001 From: Alexey Romanoff Date: Thu, 9 Jun 2022 12:22:39 +0300 Subject: [PATCH 2/2] fix(ajsf/core): input component: update value on focusin in order to invoke validation Fixes #315 --- .../ajsf-core/src/lib/widget-library/input.component.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/ajsf-core/src/lib/widget-library/input.component.ts b/projects/ajsf-core/src/lib/widget-library/input.component.ts index 929089b0..bf15480a 100755 --- a/projects/ajsf-core/src/lib/widget-library/input.component.ts +++ b/projects/ajsf-core/src/lib/widget-library/input.component.ts @@ -26,7 +26,8 @@ import { JsonSchemaFormService } from '../json-schema-form.service'; [id]="'control' + layoutNode?._id" [name]="controlName" [readonly]="options?.readonly ? 'readonly' : null" - [type]="layoutNode?.type"> + [type]="layoutNode?.type" + (focusin)="updateValue($event)"> + (input)="updateValue($event)" + (focusin)="updateValue($event)">