diff --git a/lib/core/src/lib/form/components/form-field/form-field.component.spec.ts b/lib/core/src/lib/form/components/form-field/form-field.component.spec.ts index b8832677331..11b754cb123 100644 --- a/lib/core/src/lib/form/components/form-field/form-field.component.spec.ts +++ b/lib/core/src/lib/form/components/form-field/form-field.component.spec.ts @@ -66,11 +66,13 @@ describe('FormFieldComponent', () => { const widgetInstance = component.componentRef.instance; const updateFormControlState = spyOn(widgetInstance, 'updateReactiveFormControl'); + const instanceFormValidation = spyOn(widgetInstance.field.form, 'validateForm'); widgetInstance.formService.formRulesEvent.next(); fixture.detectChanges(); expect(updateFormControlState).toHaveBeenCalled(); + expect(instanceFormValidation).toHaveBeenCalled(); }); it('should create custom component instance', () => { diff --git a/lib/core/src/lib/form/components/form-field/form-field.component.ts b/lib/core/src/lib/form/components/form-field/form-field.component.ts index de92de8068d..b7e2a232c34 100644 --- a/lib/core/src/lib/form/components/form-field/form-field.component.ts +++ b/lib/core/src/lib/form/components/form-field/form-field.component.ts @@ -87,8 +87,10 @@ export class FormFieldComponent implements OnInit, OnDestroy { const componentType = this.formRenderingService.resolveComponentType(originalField); if (componentType) { this.componentRef = this.container.createComponent(componentType); + const instance = this.componentRef.instance; instance.field = this.field; + instance.fieldChanged.subscribe((field) => { if (field && this.field.form) { this.visibilityService.refreshVisibility(field.form); @@ -107,7 +109,7 @@ export class FormFieldComponent implements OnInit, OnDestroy { private updateReactiveFormControlOnFormRulesEvent(instance: any): void { instance?.formService.formRulesEvent.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => { instance?.updateReactiveFormControl(); - this.triggerFormFieldChanged(instance.field); + instance?.field?.form.validateForm(instance?.field); }); } diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.ts b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.ts index 727b0e477d0..9ff9cc6b05d 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.ts @@ -199,6 +199,7 @@ export class DropdownCloudWidgetComponent extends WidgetComponent implements OnI private updateFormControlState(): void { this.dropdownControl.setValidators(this.isRequired() ? [Validators.required] : []); + this.field?.readOnly || this.readOnly ? this.dropdownControl.disable({ emitEvent: false }) : this.dropdownControl.enable({ emitEvent: false });