Data Binding
Form field default values can reference $data paths, which are resolved before PDF generation. This lets you create templates with fields that arrive pre-populated from your data — recipients review and edit, rather than starting from scratch.
See Data Binding for the broader $data reference system.
Block fields: the simplest pre-fill
A block field takes a token in its value as it is, with no quoting rule to keep: the value is one JSON string, so a comma in the data never splits anything. For a choice or listBox, value is the option's text, so the data can hold the department's name rather than its position in the list:
{
"content": [
{ "field": { "label": "Full name", "name": "fullName", "value": "$data.applicant.fullName", "width": 220 } },
{ "field": { "label": "Address", "name": "address", "value": "$data.applicant.address", "width": 300 } },
{ "field": { "label": "Department", "name": "dept", "fieldType": "choice",
"options": ["Engineering", "Sales", "Operations"], "value": "$data.applicant.department" } }
]
}
A value the data fills in that is not one of the options selects nothing, and the render reports it. checked is a literal true or false; to tick a box from data, use the checkbox tag below, whose state slot takes a token.
Quoting rule
$data references are filled in when the document is composed, before the tag is read. Quote a value that may hold a comma once the data is filled in (an address, a name such as Doe, Jane), or the comma would split the slot; text fields, text areas and date pickers honour single quotes:
{ "p": "Full Name: [textfield, fullName, '$data.applicant.fullName', 200|20]" }
Numeric and boolean values don't need quotes:
{ "p": "[checkbox, termsAccepted, $data.preferences.termsAccepted, 16|16] I accept the terms" }
Pre-filled review form
Combine fields with $data to deliver pre-populated forms recipients can review and edit:
{
"table": {
"widths": [1, 2],
"rows": [
[
{ "p": "Full Name:", "style": "fieldLabel" },
{ "p": "[textfield, fullName, '$data.applicant.fullName', 220|22]" }
],
[
{ "p": "Email:", "style": "fieldLabel" },
{ "p": "[textfield, email, '$data.applicant.email', 220|22]" }
],
[
{ "p": "Phone:", "style": "fieldLabel" },
{ "p": "[textfield, phone, '$data.applicant.phone', 220|22]" }
],
[
{ "p": "Department:", "style": "fieldLabel" },
{ "p": "[choicefield, dept, Engineering|Sales|Operations, 0, 200|22]" }
]
]
}
}
A choice field's tag selects by index only (0 here), so pre-filling it from data takes a $data value that holds the index; a block choice field selects by the option's text instead (above).
When generated with this data:
{
"applicant": {
"fullName": "Sophie Müller",
"email": "sophie.mueller@example.com",
"phone": "+49 30 1234 5678"
}
}
The resulting PDF text fields arrive pre-filled — and recipients can still edit them.
Common patterns
Optional fields
Use empty defaults so recipients see blank fields:
{ "p": "Notes:[br][textarea, notes, , 400|80]" }
Conditional pre-fill via the data layer
When a value may be missing, supply a default at the data layer rather than in the tag — keeps the template clean:
{ "p": "Reference: [textfield, reference, '$data.shipment.reference', 220|22]" }
{ "shipment": { "reference": "" } }
Read-only values
Form fields stay editable by default. To deliver a static rendering of values, use plain paragraph text instead of a field tag.