Schema and values
QForm Builder separates form structure from submitted data.
| Data | Role |
|---|---|
schema | Fields, structures, Quasar/FormKit options and metadata required for rendering. |
values | Current form values. |
settings | Builder 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:
- validate its shape;
- reject dangerous unknown properties;
- limit string sizes;
- keep files outside JSON;
- log important changes.