This article explains how to setup up gating questions. This means a question is shown or hidden based on the answer to another question. This way only relevant questions are shown to the user.
To create this, you need to setup a template with a dropdown where the user can select an answer. The selected answer will insert a text element (or slide) with specific questions. Depending on the possible answers you need to create multiple text elements (or slides), each with their own set of questions (form fields). It's also possible to setup a template with a checkbox (that shows a gating question when the checkbox is checked), but in this article a dropdown is used.
Gating questions can be created in Word (using text elements) and PowerPoint (using slides).
Prerequisites
|
What is needed to create a template with gating questions?
To create a template with gating questions you need the following:
- A template with a dropdown to choose from.
- One or more text elements or slides containing specific questions (form fields).
- A data source (used for the dropdown) that contains a column with the Asset ID's of the text element(s) or slide(s) to be inserted.
Important
|
Example of gating questions in Microsoft Word
In this example a dropdown is created where the user can choose to order a pencil or a ruler. When the pencil is chosen the next question will be a dropdown to choose a color. If the ruler is selected then the next questions will be dropdowns to choose the desired length and material. The user will also have the option to order nothing, in that case no additional question will be shown.
Tip: read the article about Using smart fields in Word before continuing with this example.
Create the 'Pencil' text element
- Create a data source named 'Colors' and add some colors to the Name column. The result looks like this:
- Create a new template named 'Pencil'.
- In Template Designer on the Form tab, click + Add question and create a Dropdown form field with these values:
- Type: 'Dropdown'.
- Question title: 'Choose color'.
- Data source: 'Colors'.
- Label column: 'Name'.
- The result looks like this:
- Click Add to form.
- In the template type a placeholder text for the color (e.g. '[Color]'). Select the placeholder.
- On the Template tab click Form responses, expand Choose_color and select Name.
- Click Add to template. The result looks like this:
- Save the template as 'Pencil.docx' and upload it to the asset library 'Text elements' in the Admin Center.
Create the 'Ruler' text element
- Create a data source named 'Sizes' and add some sizes to the Name column. The result looks like this:
- Create a data source named 'Materials' and add some materials to the Name column. The result looks like this:
- Create a new template named 'Ruler'.
- In Template Designer on the Form tab, click + Add question and create a Dropdown form field with the values below. Then click Add to form:
- Type: 'Dropdown'.
- Question title: 'Choose size'.
- Data source: 'Sizes'.
- Label column: 'Name'.
- Click + Add question again and create a Dropdown form field with the values below. Then click Add to form:
- Type: 'Dropdown'
- Question title: 'Choose material'.
- Data source: 'Materials'.
- Label column: 'Name'.
- In the template type a placeholder text for the size (e.g. '[Size]'). Select the placeholder.
- On the Template tab click Form responses, expand Choose_size and select Name.
- Click Add to template.
- Next type a placeholder text for the material (e.g. '[Material]'). Select the placeholder.
- On the Template tab click + Add smart field, then click Form responses, expand Choose_material and select Name.
- Click Add to template. The result looks like this:
- Save the template as 'Ruler.docx' and upload it to the asset library 'Text elements' in the Admin Center.
Create the 'Invoice' template
Now it's time to create the template. It will contain a dropdown where the user can choose between 'Pencil' (that inserts the 'Pencil' text element), 'Ruler' (that inserts the 'Ruler' text element) or 'Nothing'.
- Create a data source named 'Choice' with a Name and AssetID column (of Type 'Text').
-
Create a record with the Name 'Nothing' and leave the AssetID field empty.
-
Create a record with the Name 'Pencil'. In the AssetID field enter the Asset ID of the 'Pencil' text element (click the three dots behind the 'Pencil' text element in the Admin Center, then click Copy asset ID and paste the value in the AssetID field in Template Designer).
-
Create a record with the Name 'Ruler'. In the AssetID field enter the Asset ID of the 'Ruler' text element. The result looks like this:
- Create a new template named 'Invoice'.
-
In Template Designer on the Form tab, click + Add question and create a Dropdown form field with the values below. Then click Add to form:
- Type: 'Dropdown'.
- Question title: 'Choose product'.
- Data source: 'Choice'.
- Label column: 'Name'.
- Default value: 'Nothing'.
- On the Form tab, click + Add question and create a Text form field with the values below. Then click Add to form:
- Type: 'Text'.
- Question title: 'Closing'.
- Prefill text: 'Thanks for your order!'.
- In the template type a placeholder text for the product (e.g. '[Product]'). Select the placeholder.
- On the Template tab click Form responses, expand Choose_product and select Name.
- Click Add to template.
- In the template type a placeholder text for the product text element (e.g. '[TE_Product]', where 'TE' is short for 'Text Element'). Select the placeholder.
-
On the Template tab click + Add smart field, then click Text element.
-
In the Asset ID field type the binding
{{Form.Choose_product.AssetID}}
and enable Replace On Update. The result looks like this:
Important
-
You need to use a binding to the data source like
{{Form.Choose_product.AssetID}}
. If you would type the Asset ID of a text element instead then this text element would always be inserted and in this case that should not happen; depending on the choice of the user, nothing should be inserted, or the 'Pencil' or 'Ruler' text element. - The binding is case sensitive.
-
The option Replace On Update is enabled because that allows the user to change the answer after the document is created, using Update document.
If the option is not enabled then the dropdown would not be shown anymore. - A text element (content control) needs to be placed in it's own paragraph (or table cell). Using a text element in a sentence is not supported.
-
You need to use a binding to the data source like
- Click Add to template.
- In the template type a placeholder text for the closing (e.g. '[Closing]'). Select the placeholder.
- On the Template tab click + Add smart field, then click Form responses and select Closing.
- Click Add to template. The result looks like this:
-
If you open the Form tab note that a field named 'Placeholder 1' has been added (1). This determines where the questions (form fields) from the text element will appear in the task pane.
Since it makes no sense to show the questions after the 'Closing' question, move the 'Placeholder 1' up, so that it is positioned below the related 'Choose product' question (2).
Finally rename 'Placeholder 1' to 'Product'. The result looks like this (3):
Note
- When you add a Text Element smart field then a placeholder for the text element is automatically added. By default the Placeholder field (see image from step 13) shows 'Generate new'. This will create a (new) placeholder named 'Placeholder 1', 'Placeholder 2' etc.
- It's not required to rename a placeholder, but if a template has many placeholders then names like 'Product', 'Disclaimer' etc. are easier to recognize then 'Placeholder X'.
- Save the template as 'Invoice.docx' and upload it to the asset library 'Documents' in the Admin Center.
Creating a document
When a user creates a document with the template then by default 'Nothing' is selected in the 'Choose product' dropdown and no additional (dropdown) questions are shown.
If the user selects 'Pencil' then one additional dropdown 'Choose color' is shown and when 'Ruler' is selected the two additional dropdowns 'Choose size' and 'Choose material' are shown:
When the user selects 'Pencil' then the result in the document looks as shown in example 1 below.
When 'Ruler' is selected then the result looks as shown in example 2:
When the user selects 'Nothing' then the result looks as shown in example 3.
Of course it makes no sense to thank someone for an order if nothing has been ordered!
Also you might want to hide the complete line 'Product: Nothing' in this case. This is beyond the topic of this article, but if you want to hide text in a document based on certain conditions then you can do this by adjusting the visibility which is explained in this article and this article.
Example of gating questions in Microsoft PowerPoint
Creating gating questions in PowerPoint basically works the same as creating them in Word as shown in the example above (therefore a brief explanation in this example). In this example a dropdown is created where the user can choose to insert a slide showing a project plan with timeline. If the slide is inserted then a 'Project title' question will be shown.
Tip: read the article about Using smart fields in PowerPoint before continuing with this example.
Create the 'Project timeline' slide
- Create a new template named 'Project timeline'.
- In Template Designer on the Form tab, click + Add question and create a Text form field named 'Project title'.
- Click Add to form.
- In the template insert a shape at the position where you want to display the project title.
-
Select the shape, then on the Template tab expand Form responses, select the Project_title form field and click Add to template:
Note
If the Add to template button is greyed out then you need to reselect the shape.
- The result looks like this:
Note
The layout used in the slide above is just an example.
Only the ProjectTitle field is important. - Save the template as 'Project timeline' and upload it to the asset library 'Slides' in the Admin Center.
Create the 'Project proposal' template
Now it's time to create the template. It will contain a dropdown where the user can choose between 'Yes' (that inserts the 'Project timeline' slide) or 'No' (nothing will be inserted).
- Create a data source named 'Options' with a Name and AssetID column (of Type 'Text').
-
Create a record with the Name 'No' and leave the AssetID field empty.
-
Create a record with the Name 'Yes'. In the AssetID field enter the Asset ID of the 'Project timeline' slide (click the three dots behind the 'Project timeline' slide in the Admin Center, then click Copy asset ID and paste the value in the Asset ID field in Template Designer). The result looks like this:
- Create a new template named 'Project proposal'. Add one or more slides (in this example 3 slides are added - see image shown in step 8).
-
In Template Designer on the Form tab, click + Add question and create a Text form field with the values below. Then click Add to form:
- Type: 'Text'.
- Question title: 'Customer name'.
-
On the Form tab, click + Add question and create a Dropdown form field with the values below. Then click Add to form:
- Type: 'Dropdown'.
- Question title: 'Insert Project timeline slide?'.
- Data source: 'Options'.
- Label column: 'Name'.
- Default value: 'No'.
- In the template insert a shape at the position where you want to display the customer name (in this example it's inserted in the lower left corner on the first slide).
- Select the shape, then on the Template tab expand Form responses, select the Customer_name form field and click Add to template. The result looks like this:
-
Now select the position where you want the 'Project timeline' slide to be inserted when the user chooses 'Yes'.
If you want the slide to be inserted between slides '2' and '3', then select slide '2' (in the following steps the placeholder slide will then be inserted after slide '2') on the left of the screen:
-
On the Template tab click + Add smart field, then click Slide(s):
-
In the Display name field type a name for the field (e.g. '[SL_ProjectTimeline]', where 'SL' is short for 'Slide') and in the Asset ID field type the binding
{{Form.Insert_Project_timeline_slide.AssetID}}
. Then click Add to template:
-
The result looks like this:
Note
- A placeholder slide is added (after slide '2'). When a user chooses 'Yes', then this will be the place where the 'Project timeline' slide will be inserted.
-
Note that on the Form tab now a field named Placeholder 1 has been added. This determines where the question (form field) from the slide will appear in the task pane.
You can rename the field and/or change the position (as described in step 18 from the Word example above), but this is optional.
- Save the template as 'Project proposal' and upload it to the asset library 'Presentations' in the Admin Center.
Creating a presentation
When a user creates a presentation with the template then by default 'No' is selected in the 'Insert Project timeline slide?' question and no additional questions are shown.
If the user selects 'Yes' then the additional dropdown 'Project title' is shown:
When the user selects 'No' then the result looks like this (3 slides):
NoteNote that the 'Insert Project timeline slide?' dropdown is only shown on initial creation of the presentation. When the user clicks Update document then only the 'Customer name' field is shown, but the 'Insert Project timeline slide?' dropdown will not be available anymore. |
When 'Yes' is selected then the result looks like this (4 slides):
Note
|
Comments
Article is closed for comments.