CaseLeaf

Handbook / Building a form

Building a form

Drawing form fields, arranging them, filling them in, and getting the answers back out again. This page is the Form menu, start to finish. The Fields pane is where you find a field once it exists. The field tool draws one.

What a field is before it is a field

Nothing you draw here is a mark. It is a proposal: a dashed, see-through box that can be moved, resized and deleted like any mark, but kept out of every mark list. It is a place somebody else will write, not something you are saying. The field tool makes one by hand, wherever a page wants a box. A proposal becomes a real field - fillable, listed among a document's fields, savable - only when you finish the form. Until then it can vanish with no trace beyond an undo.

Drawing a field

Form ▸ Add Field offers nine kinds, in the order Acrobat's own "Add form components" panel lists them: Text Field, Text Area, Checkbox, Radio Button, Drop-down List, List Box, Boxed Characters, Date Field, Digital Signature. Choose the kind first, then drag out where it goes. This is the reverse of drawing a box and retyping what it is.

Three of Acrobat's own components are missing on purpose. A button, an image field and a barcode exist there only as JavaScript, and this application does not write documents that run code. A Date Field is not one of those: it is a plain text field with a hint attached, nothing more. Acrobat's own version works the same way once its script is removed. Boxed Characters always starts as a row of eight cells. The Properties sheet has no control for changing that count, so a different number needs the command line - see below.

A Digital Signature field is not the same thing as signing a document. Signing draws a mark on the page. A signature field is a cryptographic claim about who approved the document. It is signed in Acrobat or Preview, not here.

Beside Add Field is Add Label: words printed on the form, such as a heading or an instruction, rather than a place to write. A heading typed as a text field is a box nobody was ever meant to fill in.

The Field Properties sheet

Form ▸ Field Properties… opens on whichever proposed field or fields are selected. It has about twenty controls, grouped into what a field is, what it holds, how it is shown, where it is, and what rules govern it:

  • What it is - its Name (the answers come back under this name; two fields sharing a name are one field), its Kind, its Choices (a comma-separated list used only by a drop-down or a list box), and the question these buttons answer (the group name that makes several radio buttons exclusive of each other). The last two are shown for every kind and ignored where they do not apply.
  • What it holds - what it says before anybody types in it, the most characters it will take, and what is said on hover. This is what a reader using a screen reader, or a slow mouse, meets before they commit to an answer.
  • How it is shown - its Visibility (Visible; Hidden; Visible but does not print; Hidden but printable), and which way it is Turned (0°, 90°, 180°, 270°). The box itself never moves when turned, only what is written inside it, which suits a sideways table heading or a landscape form filled in portrait. It also covers appearance: whether it has a Border and a Fill, in what colours, how thick the border is, whether the line is Solid, Dashed or a Write-on line, and the size and colour of the text a reader types into it.
  • Where it is - the rectangle, given as Left, Right, Bottom, Top, Width and Height rather than as position and size. A form is laid out by where things end, and "make this end where that one ends" cannot be typed against x, y, w and h without doing the subtraction yourself first. A units menu lets you type in points, millimetres, centimetres or inches. A Move rather than resize switch decides whether typing one edge slides the field or stretches it. This group is offered only with one field selected, because a typed rectangle given to several fields at once would stack them on top of each other.
  • Rules - Must be answered, and Stated, not asked, which marks the document as telling the reader something rather than asking them for it, and makes the field read-only.
  • Locked, on its own below a rule at the foot of the sheet. It guards the field against being moved, resized or deleted while you are building the form. It says nothing about filling the form in - a locked field still accepts answers.

With several fields selected, everything above is given to all of them at once, starting from what the first one says. The name and the rectangle stay per field and are left off the sheet entirely, so finishing a row of twelve fields is one visit rather than twelve.

Apply writes the whole sheet to every field it was opened on, as one undo step however many fields that is. Cancel closes it having changed nothing.

What is not here: Actions, Format, Validate and Calculate are JavaScript in Acrobat's own dialog, and this application does not offer them for the same reason it does not offer a button or a barcode. The font is fixed as Helvetica.

The same sheet is reachable by right-clicking a field. The same click also offers shortcuts to its commonest single settings - Rename Field…, Set as Required Field, and Delete - without opening the whole sheet.

Laying fields out

A grid (Form ▸ Show Grid, ⇧⌘U) gives you something to line boxes up against, a line of type apart.

Alignment works exactly as it does on any mark: select several fields and choose Form ▸ Line Up for edges, centres, matching sizes or even spacing. Right-click a field instead and the same commands appear split across two submenus - Align, Distribute or Centre for edges, centres and spacing, and Set Fields to Same Size for Same Width and Same Height. Both do what the Form menu's own Line Up does. Notes ▸ Arrange ▸ Group (⌥⌘G) and Ungroup (⌥⇧⌘G) turn several selected fields into one thing that moves and lines up as a whole, as they do for any other marks.

Create Multiple Copies…, from a field's context menu, makes a row or a column of the same field. The size and kind stay the same, the gap between them is yours to set, and each copy is numbered from the first one's name. How many copies is that number: three unless you say otherwise, and at most two hundred, counted after the one you started from. Create makes as many of them as the page has room for, stopping at the edge rather than placing one where nobody could reach it. Cancel makes none. This saves the tedious part of laying out a form of forty: doing it once instead of forty times. Duplicate Across Pages puts the same field, in the same place, on every other page - the case a reference number at the foot of every sheet is for. It skips any page too small to hold it rather than placing it somewhere nobody can reach. Use Current Properties as New Defaults takes a field's kind, its required and read-only state and its hover text as the starting point for the next field you add, so a run of the same kind of field does not mean retyping the same three answers each time.

Tab order

Reading order - across, then down - is right often enough that nothing is recorded until you say otherwise. It is wrong exactly where a form has two columns: the caret hops the gutter between every pair of fields instead of filling the left column and then the right. Form ▸ Tab Order offers both Along Each Row and Down Each Column, worked out from where the fields actually sit on the page rather than assumed. A one-column form gets the same answer either way. A single field can also be nudged earlier or later from its context menu, without renumbering the rest of the page.

Show Tab Numbers draws the order on the page while you decide whether it is right. This matters because an order nobody can see is one nobody can check.

Building, previewing and finishing a form

Form ▸ Edit Form (⌃⇧⌘F) is the one switch. On, the fields are boxes you can move and name, and the drawing tools sit beside the page. Off, they are a form to fill in. Turning it off writes the form. There is no separate step to remember: leaving the mode, or saving, both do it, and Form ▸ Finish Form writes it directly for anyone who wants to say so. A document sitting between "boxes drawn" and "form finished" is a state with no name and nothing on screen to explain it.

Preview shows the page as a reader will meet it: the boxes drawn the way they will be written, the palette and the grid put away. It writes nothing. Choosing it again goes back to building. It is the only way to see whether a field's fill is about to cover a ruled line already printed on the page, which a dashed proposal outline hides from you.

Opening a form this application already wrote is safe. Opening one written by something else is not. Editing a written form takes it apart, back into boxes. What this application cannot hold does not survive the round trip: scripts, formats, validation, calculations, embedded fonts, and any appearance another program drew. You are asked before it happens, and told plainly what is at stake. Answers already in the form fare unevenly, too. Text is carried back into the boxes. What is in a tick box, a radio group or a list is not carried back - those come back unanswered on purpose, so that reopening a form never quietly answers a question on the reader's behalf. Export the answers first if they matter.

Making a form from a page that has none

A flat page - a word-processed document with underscores and bracketed blanks, or a scan with ruled lines and boxes - gains its fields from the field tool, one box at a time, where the page wants one. Draw them, name them in the Fields pane, and finish the form.

The command line has caseleaf makeform <file> --to <output>, which looks at a page, guesses where its fields are and writes them straight into a copy, with nothing offered to correct in between. The guessing is not finished: it can propose a box where there is none and miss a real one, so what it writes needs going through before anyone fills it in. For a form to send out, draw the fields here.

Filling a form in

Once a form is finished, a field is filled the way any PDF reader fills one: click it and type, tick it, or choose from its list. Form ▸ Highlight Fields (⇧⌘H) washes every field that can be filled, and outlines in red the ones that must be. This is useful because a well-drawn form is quiet, which makes it hard to find anything on.

What comes back depends on the kind of field. A text field's value is what was typed. A tick box or a radio group holds its export value: the name of whichever state is on, or nothing if none is. That is what the file itself records. Deciding that "off" means "no" would be this application answering on the reader's behalf.

Getting the answers out, and putting them in

Form ▸ Export Answers… writes what a filled form holds as two columns, field and value, to a file that opens in any spreadsheet. Import Answers… reads the same shape back in. A field the form does not have is skipped rather than invented, so a column added to the spreadsheet by hand cannot conjure up a field that disagrees with the document it came from. Importing replaces whatever was already filled in, and is a single undo step.

Gather Filled Copies… is for the moment a form was actually sent out for. Choose several returned copies, and they are read into one table, a row per document and a column per field. A copy with no answers in it is named rather than silently dropped: losing one of forty copies without being told is worse than being told which one had nothing to read.

Restyling existing fields

Form ▸ Redraw the Fields draws a document's existing fields the way a new one would be drawn today, without changing anything about what they mean: names, values, required and read-only flags, tab order, all untouched. A field's appearance is fixed the moment it is created, so a form drawn before you chose, say, no fill still carries the wash that covers a paper form's own printed lines. This is how the older fields catch up.

This is not an undo-able edit. What changes is each field's own drawing, which the undo stack has no shape for. The document is marked as edited, and nothing is written to disk until you save. If you change your mind, the way back is to close without saving.

From the command line

Everything above has a command-line equivalent, for working on files this application never opens:

Command Does
fields Proposes fields for a flat page, without writing any of them.
makeform Detects and writes fields into a page that has none, in one step.
writefields Writes fields you give it - the shape fields prints, corrected - rather than fields it detects itself.
fillform Fills a form from a two-column file of answers.
answers Reads what a filled form holds, to a file or as JSON.
gather Reads many filled copies into one table.
restyle Redraws a form's existing fields with a different border and fill.

Run any of them with --help for its exact arguments - see the command for how the command line works in general.

Watch: a short video for this page is still to come.


Fields · Draw a field · Signing · The command · Contents