dynamic-forms / Interface

FormEvent

Base interface for all form events in the dynamic form system.

All form events must implement this interface to be compatible with the event bus system. The type property is used for event filtering and type-safe subscriptions.

Properties

NameTypeDescription
formValue
r
unknown

Optional form value attached to the event when withEventFormValue() is enabled or options.emitFormValueOnEvents is set to true in the form config.

Use the hasFormValue() type guard to check if this property is present.

type
r
string

Unique identifier for the event type used for filtering and subscriptions

Example usage

export class SubmitEvent implements FormEvent {
  readonly type = 'submit';
}

export class ValidationErrorEvent implements FormEvent {
  readonly type = 'validation-error';
  constructor(public errors: ValidationErrors) {}
}