Declaration & Forms

How to configure the declaration and action forms

Declaration form

The declaration property on the EventConfig schema includes the configuration for the primary record declaration details. For example, for a birth registration event it should contain:

  • The child's details, such as the date and place of birth

  • The birth informant's details

  • Parents' details

When configuring your declaration form, make sure to use the defineDeclarationForm() helper.

Example:

// src/events/birth/forms/declaration.ts
import { defineDeclarationForm, FieldType } from '@opencrvs/toolkit/events'
import { child } from './pages/child'
import { informant } from './pages/informant'
import { mother } from './pages/mother'
import { father } from './pages/father'

export const birthDeclarationForm = defineDeclarationForm({
  label: {
    defaultMessage: 'Birth declaration form',
    id: 'event.birth.action.declare.form.label',
    description: 'This is what this form is referred as in the system'
  },
  pages: [child, informant, mother, father]
})

// src/events/birth/index.ts
import { birthDeclarationForm } from './forms/declaration'

export const birthEvent = defineConfig({
  id: 'birth',
  declaration: birthDeclarationForm,
  // ...
})

Action forms

In addition to the primary form, certain actions have forms of their own. These include:

Configured action type
Config property
Description

ActionType.DECLARE

review

Fields to be filled on the review page when declaring a record.

This usually includes details of the employee filling the form, such as their signature and additional comments.

ActionType.READ

review

Fields to be shown on the review page of a record.

This is usually the same as the review config on ActionType.DECLARE.

ActionType.PRINT_CERTIFICATE

printForm

Form pages to be filled When printing a certificate of a registered record.

ActionType.REQUEST_CORRECTION

correctionForm

Form pages to be filled when requesting a correction on a registered record.

ActionType.CUSTOM

form

Fields to be filled on the confirmation dialog of the custom action.

Each of these forms is configured to the action's own configuration. For configuring actions, see Actions.

When configuring a printForm or correctionForm, use the defineActionForm() helper from @opencrvs/toolkit/events.

Pages

The declaration, printForm and correctionForm configurations use pages to split the different form sections into separate pages. Each page may contain any amount of form fields.

There are two types of pages:

  1. PageTypes.enum.FORM for pages with form fields and a simple continue button.

  2. PageTypes.enum.VERIFICATION which, instead of a continue button, has the options to verify or cancel the page. Both options continue the form to the next page. The chosen option is saved to the action's details and displayed on the action audit log. Note: Verification-pages may only be used on action forms, not the declaration form!

When configuring pages, make sure to use the definePage() helper.

Example:

PageConfig schema

Last updated