A web form submission can be reproduced as a PDF to serve as a record of the answers given online.
The template shows how to display check boxes, radio buttons and multiple tick boxes.
Conditional logic can be used to exclude a non-applicable section of the form, whilst repeating logic allows multiple responses to a question.
This example in detail
Adding a form timestamp
It is possible to display the precise time that a form is filled out.
The time can be derived using the built-in variable $nowUTC.
$nowUTC returns the current date/time in UTC. (coordinated universal time)
The timeOffset field in the data, provides the difference in hours between the relevant time zone and UTC.
By using the dateAdd function, in combination with $nowUTC and the supplied timeOffset it is possible to shift the date/time to the required time zone.
In this example, the timeOffset of "-4" is applied to the UTC date/time to localize it for Boston in the United States.
The result is the date and time appearing in the following output format on the form.
Using tables to control the layout
Tables are used to control the layout and positioning of information on the form.
Tip: To see the individual tables that are used in the different sections of the form, choose View Gridlines on the Layout ribbon.
Merge Cells and Split Cells are used to achieve the desired layout for each table.
Fixing the size of tables
To ensure the tables in the different sections of the form don’t expand in an unpredictable way when filled with data, the layouts are kept “fixed” in size.
To achieve this:
-
Ensure the Automatically resize to fit contents check box is unchecked.
-
The exact height of each table row is specified.
Using shading for answer boxes
This example shows that table cell shading can be used to highlight the answers.
Using wingding symbols
In Microsoft Word, there are webdings and wingdings that display as graphical symbols.
Some of these symbols such as check boxes, ticks and crosses are useful for replicating form responses.
The wingding fonts below have been used to create this form example.
These wingdings can be accessed from the Insert ribbon.
Using check boxes
Check box questions provide a choice between one of two mutually-exclusive options.
A user will answer either:
- Yes with the Yes box checked and the No box kept unchecked.
OR - No with the Yes box left unchecked and the No box checked.
With a check box question:
- A boolean field from the data determines whether Yes (true) or No (false) has been selected.
- An Else-if statement determines whether the Yes box should be checked or unchecked.
- Another Else-if statement determines whether the No Box should be checked or unchecked.
Note: Checkbox questions require two Else-If statements to address both possible options.
Using radio buttons
Radio buttons allow only one option to be chosen from multiple answer options.
In this example, the chosen option is represented as a wingdings dot within a table cell.
A single text field in the data stores the chosen option.
In the table cell next to each option, is a semi-hidden <<cs_ If statement that checks whether the user has chosen this option and if this is true, a dot is displayed.
Using multiple tick options
Multiple options can be selected for the question below.
The data shows a boolean field for each option.
In the table cell next to each option, is a semi-hidden <<cs_ If statement that displays a wingding tick if the boolean value is true.
Creating conditional questions
It is possible to exclude certain questions from showing, based on the answers to previous questions.
Here if the answer to the question “How often do other people drive the vehicle?” is Never, then the subsequent question “Can you please name the other drivers?” is not applicable.
Here the <<cs_{anyOtherDrivers!=’Never’}>> conditional expression ensures that this second question only shows if the answer to the prior question is not Never.
For further information on conditional expressions, refer to Conditional Sections.
Allowing multiple responses to a question
Some questions can have one or more answers.
In this example, the otherDrivers array shows the answers given to the question.
Here, the <<rr_ statement loops over the answers in the otherDrivers array, adding a new table row for each answer.
For further information on using <<rr_ statements refer to Tables – Part One.