Function

withValidationExecutionDefaults

@ng-forge/dynamic-forms

Configures global validation execution defaults — when validators should run relative to a field's reactive state.

By default, validators are skipped for hidden fields (validateWhenHidden: false), matching what most users expect: a hidden field is inert. Use this feature to restore the legacy behavior where hidden fields still validate.

Remarks

Precedence rules: 1. Per-field FieldDef.validateWhenHidden — wins for that field; inherits down to descendants that don't override. 2. Per-form FormOptions.validateWhenHidden — root inherited value for the form. 3. Global withValidationExecutionDefaults() — fallback when no form/field setting. 4. No feature configured — uses token default (validateWhenHidden: false).

Signature

function withValidationExecutionDefaults(config?: Partial<ValidationExecutionConfig> | undefined): DynamicFormFeature<"validation-execution">

Parameters

NameTypeDescription
config?Partial<ValidationExecutionConfig> | undefined- Partial override. Unspecified properties keep their defaults.

Returns

DynamicFormFeature<"validation-execution">

Examples

provideDynamicForm(...withMaterialFields())
// hidden fields skip validation
provideDynamicForm(
...withMaterialFields(),
withValidationExecutionDefaults({ validateWhenHidden: true })
)