This article explains how to allow the user to pick a date in the response form so it can be used to populate the smart template.
Prerequisites
|
How to allow for a date input in the response form
When building the response form, the Date question can be used to select a date.
Creating a Date question can be achieved by following these steps:
- In Template Designer, open the Form tab.
- Click + Add question.
- In the Type field select Date.
- In Question title type the question. This is the question that will be displayed to the end-user.
- Optionally, set additional settings:
-
Required: Enable this option if the user should be prevented from finalizing the generation of the document if the input is missing. An asterisk will be displayed in the response form to indicate that the question is mandatory.
Important
- If the field is not required then the default date is empty.
- If the field is required then the default date is today.
- Reference name: Will be prepopulated based on the question title. The reference name will be displayed when using the form responses and is also the name used in the binding syntax.
- Default value: Prepopulate the question with a default value to guide the user when filling in the response form. The default value can be edited.
- Spacing before: Edit the space between the question and the elements above it in the response form (None, Medium, or Large).
- Spacing after: Edit the space between the question and the elements below it in the response form (None, Medium, or Large).
- Helptext prefix: Add additional help text above the question to guide the user.
- Helptext postfix: Add additional help text below the question to guide the user.
- Share value: Enable the Share value option if the same question is used in the response form of dynamic text elements or slides that would be inserted when generating a document or a presentation. The answer to the question will be reused to avoid prompting the user with redundant questions.
-
Required: Enable this option if the user should be prevented from finalizing the generation of the document if the input is missing. An asterisk will be displayed in the response form to indicate that the question is mandatory.
- Click Add to form.
Tip
- Once the question has been created you can click Preview form to see how the question will appear to the end-user.
- Use the FormatDateTime() function to set how the date will appear in the document.
How to set a default date
It is possible to set a specific date, for example a date retrieved from the User Profile like {{UserProfile.StartDate}}
. Type the binding in the Default value field like this:
In the response form the result looks like this:
When the option Required is enabled the result looks like this:
Use the DateValue() function
It's also possible to use bindings as shown below using the DateValue() function.
The output is the date shown in the question in the response form:
Binding | Output |
---|---|
{{DateValue("2024/04/10","yyyy/MM/dd","en-US")}} | 2024-04-10 |
{{DateValue("9 januari 2024","d MMMM yyyy","nl-NL")}} | 2024-01-09 |
{{DateValue("Oct 18th, 2024","MMM d'th,' yyyy","en-US")}} | 2024-10-18 |
Important
|
Example
Required date for a contract
Create a Date question with Question title 'Contract start date':
Comments
Article is closed for comments.