Accessible continuation sheets in PDF forms, made easy

3rd February 2020 | by Ted Page

How a little (beginner-level) JavaScript can save the day

Failing to alert screen reader users that they have reached the character limit in a form field, and hence that any further text they might type would be lost, could have serious consequences.

Many different types of PDF form, such as the one below, necessarily contain answer spaces that span two or more pages.

An 'additional information' form field requiring a continuation sheet on the next page

The problem

But there is potentially a serious accessibility problem with creating a multi-page answer space like this in a PDF form: on a Mac you will get a beep to tell you when you have filled up a text field and need to move on to the next page to continue your answer. However, on a Windows machine, out of the box, there is no such warning.

As a result, having filled up the space available in a particular field, users who can’t see the page could keep on typing, unaware that everything they subsequently write will be lost. If you are sitting an exam, or filling out a job application form, the consequences could be very serious, if not catastrophic.

 The solution

The following, easy-to-apply script, will solve the problem.

if (event.fieldFull) app.alert("You have filled the given space with text. \nPlease press the space bar to close this message and then press the tab key to go to the next page to continue.", 1);

This script alerts users, by way of a screen reader accessible pop-up, that the field is full, and that they should press the space bar to close the pop-up, and then press the tab key to go to the next field.

A pop-up with instructions for the user to go to the next page

Example

An example of this can be seen in action in the “additional information” field in the following sample PDF form (which is taken from our accessible PDF forms training course) : Sample conference booking form (PDF 92KB)

(Note: you don’t actually have to type the 1,611 characters that it would take to fill this field. Instead you can just press the Enter key 23 times.)

Remote continuation sheets

If the continuation sheet is not the next field in the form’s tab order (it could, for example, be an additional information or notes page at the end of a document) you may also choose to add the following to the above script:

this.getField(“fieldName”).setFocus();

…where “fieldName” is the continuation field’s name attribute value. You would, of course, also have to amend the message in the pop-up as appropriate.

WCAG compliance

Given that you have warned the user as to what is about to happen, this should be fine with respect to WCAG 2.1 SC 3.2.2 (change of context). However, if you are not comfortable with this, the pop-up message could be amended to advise the user how to navigate to the appropriate page, perhaps using the Ctrl + Shift + n page navigation command.

Adding the script in Acrobat Pro

To add this script to a form field in Acrobat Pro:

  • Select Tools, Prepare Form
  • Go to the field in question and double click to open the Text Field Properties dialogue box
  • Select the Format tab
  • From the Select format category dropdown select Custom

Acrobat's Text Field Properties dialogue, Format tab, showing the Select Format Category dropdown

  • In the Custom Keystroke Script section click the Edit button

Acrobat's Text Field Properties dialogue, Format tab, highlighting the Edit Custom Keystroke Script button

  • Type or paste the script into the JavaScript Editor dialogue box and click OK

When the user now runs out of space in this field, he or she will get the above pop-up advising of that fact, and on how to proceed.

Conclusion

This simple solution can be applied in seconds to any continuation sheet in a PDF form. By contrast, not alerting users that they have reached the character limit in a particular field, and hence that any further text they might type would be lost, could have potentially catastrophic consequences in some contexts, and would at least present a serious obstacle in others.