OpenForm

Form

Last updated on

An artifact for dynamic documents with fields, annexes, and parties

A Form is the workhorse of OpenForm. It defines dynamic documents that can be populated at runtime with:

  • data fields
  • parties (including roles and signature/witness requirements)
  • annexes (attachments that can be appended at runtime)

It can be used to create a simple consent form with a few fields to complex forms with multiple nested fields, annexes, signatory requirements, and conditional rendering logic.

Properties

kind: 'form'
Literal "form" discriminator
name: string
Unique identifier; must follow slug constraints
version?: string
Artifact version (semantic versioning)
title?: string
Human-friendly name presented to end users
description?: string
Long-form description or context
code?: string
Internal code or reference number
releaseDate?: string
ISO date string indicating when the artifact was released
metadata?: Metadata
Custom metadata map (keys must be alphanumeric with hyphens)
logic?: LogicSection
Named logic expressions that can be referenced in field/annex conditions
fields?: Record<string, FormField>
Field definitions keyed by identifier
layers?: Record<string, Layer>
Named layers for rendering this form into different formats
defaultLayer?: string
Key of the default layer to use when none specified
allowAdditionalAnnexes?: boolean
Whether additional ad-hoc annexes can be attached beyond those defined in the annexes record
annexes?: Record<string, FormAnnex>
Predefined annex slots keyed by identifier
parties?: Record<string, FormParty>
Party role definitions keyed by role identifier, with constraints and signature requirements

Form Components

ComponentDescription
FormFieldField definitions for capturing user input
FormFieldsetLogical grouping of fields rendered as sections
FormAnnexAttachment slot definitions
FormPartyParty role definitions with signature requirements

Examples

kind: form
name: lease-agreement
version: "1.0.0"
title: Residential Lease Agreement
description: Standard residential lease agreement

logic:
  hasPets: "fields.petsAllowed.value == true"

fields:
  propertyAddress:
    type: address
    label: Property Address
    required: true
  monthlyRent:
    type: money
    label: Monthly Rent
    required: true
  leaseStart:
    type: date
    label: Lease Start Date
    required: true
  leaseTerm:
    type: enum
    label: Lease Term
    enum: ["12 months", "24 months", "Month-to-month"]
  petsAllowed:
    type: boolean
    label: Pets Allowed
    default: false
  petDeposit:
    type: money
    label: Pet Deposit
    visible: hasPets
    required: hasPets

parties:
  landlord:
    label: Landlord
    partyType: any
    required: true
    signature:
      required: true
  tenant:
    label: Tenant
    partyType: person
    min: 1
    max: 4  # allows 1-4 tenants (array format)
    required: true
    signature:
      required: true
      witnesses: 1

layers:
  pdf:
    kind: file
    mimeType: application/pdf
    path: /templates/lease-agreement.pdf
    bindings:
      property_address: propertyAddress
      monthly_rent: monthlyRent
  html:
    kind: file
    mimeType: text/html
    path: /templates/lease-agreement.html

defaultLayer: pdf

annexes:
  identification:
    title: Tenant Identification
    description: Copy of government-issued ID
    required: true
  proof-of-income:
    title: Proof of Income
    description: Recent pay stubs or tax returns
    required: false

Related

  • Layer - Layer specification
  • Logic - Logic section and expressions

On this page