Form Fields
DocPayload writes interactive form fields, rendered cross-format:
- PDF: emitted as AcroForm fields, fillable in any PDF reader that fills forms.
- DOCX: emitted as Structured Document Tag (SDT) content controls, fillable in Word.
The same template definition produces both. Each field is written in both formats, with these recorded differences in the DOCX:
- a radio group is one check box per button, without the group's exclusivity (reported);
- a text area is one framed line;
- a checkbox is Word's crossed box;
- a date picker is a real date control, where the PDF, which has no calendar control, writes a text field;
- a signature field, its lock and its seed values have no Word control and are not written (reported).
Eight field types are supported: text input, text area, checkbox, radio button, choice (dropdown), list box, date picker (shortcode only), and a signature field, an empty place reserved for a signature added later.
Two ways to write a field
A field is written either as a shortcode inside text, which sits on the line with the words around it, or as a block field node, which stands on a line of its own with its label drawn before it:
{ "p": "Full Name: [textfield, fullName, John Doe, 200|20]" }
{ "field": { "label": "Full name", "name": "fullName", "value": "John Doe", "width": 200, "height": 20 } }
field key | Type | Default | Description |
|---|---|---|---|
name | string | — | Required. The field's name, unique and without a period (see Field names). |
label | string | — | Drawn before the control, and announced as the field's name and tooltip. Absent, nothing is drawn and the name is announced. |
fieldType | string | text | text, textArea, checkbox, radio, choice (a drop-down), listBox or signature. |
value | string | — | The initial value: a text field's text, the selected option of a choice or listBox, or a radio button's export value. Takes $data tokens. |
options | string[] | — | The choices of a choice or listBox: required by those two, refused on any other type. |
checked | boolean | false | Whether a checkbox or radio starts on; refused on any other type. |
width, height | number | 200, 16 | The control's size in points. A checkbox or radio button is a square of the height. |
lock | object | — | signature only: the fields its signing locks. See Signature field. |
seedValue | object | — | signature only: what the field asks of whoever signs it. |
The block form has no date picker; the shortcode is the way to write one. The block form is the one to reach for when a value comes from data (no quoting rules; see Data binding), when a field needs a label of its own, drawn and announced, and in a watermark or a band, where a page token in its name gives each page its own field.
Quick start
A minimal interactive form, in shortcodes:
{
"content": [
{ "h2": "Application" },
{ "p": "Full Name: [textfield, fullName, , 220|22]" },
{ "p": "Email: [textfield, email, , 250|22]" },
{ "p": "Department: [choicefield, dept, Engineering|Sales|Operations, 0, 180|22]" },
{ "p": "[checkbox, agree, false, 14|14] I accept the terms and conditions" },
{ "p": "Notes:[br][textarea, notes, , 400|80]" }
]
}
The same form as block fields:
{
"content": [
{ "h2": "Application" },
{ "field": { "label": "Full name", "name": "fullName", "width": 220 } },
{ "field": { "label": "Email", "name": "email", "width": 250 } },
{ "field": { "label": "Department", "name": "dept", "fieldType": "choice", "options": ["Engineering", "Sales", "Operations"], "value": "Engineering" } },
{ "field": { "label": "I accept the terms and conditions", "name": "agree", "fieldType": "checkbox" } },
{ "field": { "label": "Notes", "name": "notes", "fieldType": "textArea", "width": 400, "height": 80 } }
]
}
Recipients open the PDF in a reader that fills forms, or the DOCX in Word, and type / select directly.
What's next
- Field types — full reference for the supported fields with parameters and examples, both forms.
- Data binding — pre-fill fields from
$datareferences for review-and-edit workflows. - E-Signature — signing the document itself, and how empty signature fields fit with it.