Skip to content

Schema and values

QForm Builder separates form structure from submitted data.

DataRole
schemaFields, structures, Quasar/FormKit options and metadata required for rendering.
valuesCurrent form values.
settingsBuilder settings and theme information.

This separation lets you build a form in an admin page, then render it elsewhere with other values.

Minimal schema

ts
import type { FormKitSchemaDefinition } from '@formkit/core'

const schema: FormKitSchemaDefinition[] = [
  {
    $formkit: 'text',
    name: 'email',
    label: 'Email address',
    validation: 'required|email',
  },
]

Values

ts
const values: Record<string, unknown> = {
  email: 'contact@example.test',
}

values keys match field names. Keep these names stable once the form is published.

Saved document

Application storage can keep a larger document:

ts
type QFormDocument = {
  id: string
  version: number
  schema: FormKitSchemaDefinition[]
  values: Record<string, unknown>
  settings: Record<string, unknown>
  updatedAt: string
}

Save example:

ts
async function saveDocument(document: QFormDocument) {
  await $fetch(`/api/forms/${encodeURIComponent(document.id)}`, {
    method: 'PUT',
    body: document,
  })
}

Hidden fields

A hidden field can store:

  • a literal value;
  • a controlled FormKit expression;
  • a numeric value;
  • a value excluded from submission.

Expressions are length-bounded and filtered to avoid dangerous global or prototype access.

Migration

Exported documents are versioned. When an older schema is imported, the migration registry converts it before rendering.

See Versions and migrations for details.

Security

A schema is user input. Before storing or rendering it:

  1. validate its shape;
  2. reject dangerous unknown properties;
  3. limit string sizes;
  4. keep files outside JSON;
  5. log important changes.

QForm Builder — Nuxt 4, Quasar and FormKit layer for dynamic forms.