A box the reader ticks
Add a tick box: accepting terms, choosing an option, with the mark you pick and the value the form reports.
Asked for with
"type": "check_box"
In plain words
Written for anybody. It says what this puts on a sheet of paper, and asks nothing of you beyond that.
This is the little square box you tick on screen, the one for "I accept the terms" or "I would like the newsletter". You choose where it sits, how big it is, and the mark that appears on a click: a tick, a cross, a circle, a diamond or a filled square. You can have it start already ticked. And you decide the word the form reports when it is ticked, which helps when the answer travels on to another program.
For a developer
Written for somebody who writes the calling program: the model, the units, and the settings that carry the weight.
The box is an annotation laid over the drawing; the border gives it its visible outline and the background its colour. The starting state and the state a reset restores are said separately: a box may start clear and become ticked on a reset. The reported value is what submitting the form sends; absent, it is Yes. The mark shown is picked among five symbols; absent, it is a tick for a box and a disc for a radio button.
Every key, with its default
The reference: which keys are required, which are optional, what each one defaults to and which combinations the server declines.
Required keys: name, a string; rect. Optional keys of the box itself: checked, a boolean at false, the starting state; checked_by_default, a boolean at false, the state a reset restores; symbol, one of check, cross, circle, diamond or square (absent: the tick); export_value, the string reported when the box is ticked (absent: Yes). Optional keys shared by every field: read_only, required, no_export, booleans at false; background; border (a required width, a color in light, a style); pages, default empty; relative_to. Cross refusal: a CMYK or named-space colour in border.color.
A whole request that draws it
Post this as it stands and a PDF comes back. Nothing has been left out of it.
{
"items": [
{
"type": "check_box",
"name": "terms",
"rect": {"llx": 72, "lly": 700, "urx": 86, "ury": 714},
"border": {"width": 0.75}
}
]
}
Form fields
A box the reader types into A list the reader picks from Several buttons, one answer The place kept for a signature A button the reader presses
Where to go next
Every key of a request, in one page The other twenty things you can draw
Glossary
- CMYK
- The four inks a printing press lays down: cyan, magenta, yellow and black. A screen mixes light instead, so a document going to a press states its colours in inks, not in screen colours.
- annotation
- Something laid over a page rather than drawn into it: a clickable rectangle, a box to type in, a button. It sits at its own place on the sheet and is what makes a PDF answer to a click at all.