Forms


Purpose and use

This document function can be used to query content via a form by configuring text boxes, checkboxes, dropdowns, etc., so-called elements.

This function is not available to its full extent in ‘classic’ templates.
Further information on the different template versions can be found here.

Structure

<FormsConfiguration> <Elements> <!-- Insert form elements and groups here --> </Elements> </FormsConfiguration>

Designer

If you open Forms in the template editor, you are automatically taken to the simple view. Clicking on the preview takes you to the Forms Designer. The designer allows you to put together the form in a user interface in no time at all.

Forms-SimpleEditor-20240112-173437.png

A form consists of various elements: structural elements that contribute to the clarity of the form and form elements whose values entered by the user ultimately end up in the document.

Forms-SimpleEditor-Options-20240112-173854.png

Behind the Designer user interface is an XML configuration for each element. This can be found via the ‘Advanced view’ button. All elements are now described in the following chapter.

Example

<FormsConfiguration> <Elements> <Text Id="Subject" translate-Label="Forms.Subject" /> <Date Id="Date" translate-Label="Forms.Date" RelativeDate="Today" translate-Format="Configuration.DateFormat.WrittenOut" /> <AdditionalProfile Id="MainSigner" Label="Main-signer" PreselectByIndex="1" /> <AdditionalProfile Id="CoSigner" Label="Co-signer" /> <Group Title="Additional settings"> <YesNo Id="ShowContact" Label="Show contact" Value="true"> <ElementsIfYes> <Choice Id="ContactFormOption" Label="Display type" SelectedValue="0"> <Option Value="0" Label="Impersonal contact" /> <Option Value="1" Label="Personal contact" /> </Choice> </ElementsIfYes> </YesNo> </Group> <GlobalElements Key="Forms.Attachments" /> </Elements> </FormsConfiguration>

Overview

The following form elements are possible:

Structure elements

  • Group

  • Info

Form elements

  • Text

  • Date

  • YesNo (Checkbox)

  • Choice (Dropdown)

  • AdditionalProfile

  • Object or ObjectCollection

  • GlobalSchemaAndSummary (globally stored schema/summary configuration)

  • GlobalDataProviders (globally stored DataProvider)

  • GlobalElements (globally stored Forms configuration)

Integrate additional profiles into template

The profile fields of the user who generates a document are automatically provided during document creation and contain, for example, organisational data such as logos or postal addresses as well as personal user data. By switching profiles in the primedocs ribbon, the data of the selected profile is displayed in a document that contains profile fields.

Additional profiles can be integrated into the document using AdditionalProfile. This profile selection displays the user's own profiles or external profiles that have been released for the user.
AdditionalProfiles are therefore intended for use cases in which other people from the company are to appear in the document. The use of AdditionalProfile is useful, for example...

  • for additional signatures in a template.

  • when working with other employees or departments in a template. e.g. in a template, the cost centre manager should also be mentioned in addition to the head of department.

  • in many more use cases.

The corresponding forms fields of the AdditionalProfile must therefore also be inserted in the template.

Adaptive data input mask

Forms allows fields to be displayed based on a conditional value. In the YesNo and Choice form elements, this allows you to control the appearance of other form elements based on a value. The possible form elements that can appear are: Text, Date, Choice, YesNo and Info.
Example: an info element should only be displayed if the YesNo field is activated (= true):

The elements for the adaptive data entry mask are called ElementsIfYes / ElementsIfNo for YesNo elements (for true and false) and ElementsIfValue for Choice elements (for a specific value). Examples of the XML configuration and the documentation of the ElementsIf elements can be found under Forms | Attributes for Choice and Forms | Attributes for YesNo .

<YesNo Name="ShowThing" Label="Muss unterzeichnet werden"> <ElementsIfYes> <Info>Please ensure that a signature image is stored.<Info> </ElementsIfYes> </YesNo>

Elements

Groups

Groups are structure elements and group form elements with <Group>...</Group> for visual representation.

Groups must not contain other groups (no nesting).

Attributes for Group

Attributname

Description

Attributname

Description

Title
(optional)

Title that will be displayed on the input interface.


Info

This element allows to display information text in the Forms dialog. The text to be displayed is specified as the content of the Info element.

Example:


Text

The Text element provides the user with the ability to enter text in Forms. Accordingly, it is typically displayed as a text box. A Plain Text Content Control is inserted in the Word template.

Examples

Simple

Advanced

Attributes for Text

Attribute name

Description

Attribute name

Description

Id
(required)

Required for identification (insertion in template, use in https://primesoft-group.atlassian.net/wiki/x/YQapAw ). Must not contain spaces and must be unique. Forms automatically adds the prefix Forms. (e.g. Subject becomes Forms.Subject).

Label
(required)

Label of the element in the input interface.

Value
(optional)

Predefined text that the user can edit

MultiLine
(optional)

If true: possibility in the input interface to insert line breaks

Required
(optional)

If true: user must make an input, the text must not be empty and must not consist only of spaces. Recommended: Additionally configure a specific ValidationMessage.

OnlyVisibleDuringGeneration
(optional)

If true: The field is only displayed when the document is generated for the first time. If the user opens the Forms dialogue again in the primedocs ribbon in the open document, it is no longer displayed.

Contents for Text

Element name

Description

Element name

Description

Description
(optional)

Additional information for the user filling in the form. Displayed in the input interface (possibly as a tooltip).

ValidationMessage
(optional)

Text that will be displayed to the user if this text field was filled in invalidly.


Date

The Date element allows the user to select a date in forms. It is typically displayed as a date picker. A date picker content control is inserted in the template.

Examples in XML with preview

Simple:

 

Expanded: with Value and Required:

 

Expanded: with RelativeDate:

Calculated from date: 12.01.2024

Attributes for Date

Attribute name

Description

Attribute name

Description

Id
(required)

Is required for identification (insertion in the template, use in https://primesoft-group.atlassian.net/wiki/x/YQapAw ). Must not contain spaces and must be unique. Forms automatically adds the prefix Forms. (CreationDate becomes Forms.CreationDate, for example).

Label
(required)

Description of the element in the input interface

Format
(required)

Definition of the date format, e.g. dd.MM.yyyy for ‘31.12.2020’ or d. MMMM yyyy for ‘31 December 2020’. See list of date formats.
In the basic configuration, there are several date formats in the global translations that can be accessed.

Required
(optional)

If true: The user must select a date, the date must not be empty.
Recommended: Additionally configure a specific ValidationMessage.

Value
(optional)

Preselected fixed date that the user can edit.
Format: yyyy-MM-dd, e.g. 2020-12-31
Cannot be used in combination with RelativeDate.

RelativeDate
(optional)

Preselected date that the user can edit and that is relative to the time of document creation.

  • If Today: Date of document creation

  • If FirstDayOfMonth: First day of the month of document creation

  • If FirstDayOfYear: First day of the year the document was created

The OffsetMonths and OffsetDays attributes can be used to further adjust the relative date. Examples:

  • Current day: RelativeDateOption="Today"

  • First day of the current month: RelativeDateOption="FirstDayOfMonth'

  • Last day of the previous month: RelativeDateOption='FirstDayOfMonth' OffsetDays="-1"

  • Last day of the current month: RelativeDateOption='FirstDayOfMonth' OffsetMonths='1' OffsetDays="-1"

  • Last day of the previous year: RelativeDateOption='FirstDayOfYear' OffsetDays="-1"

  • Last day of the current year: RelativeDateOption='FirstDayOfYear' OffsetMonths='12' OffsetDays="-1"

OffsetMonths
(optional)

Number of months that are added to the relative date (positive and negative numbers permitted). See RelativeDateOption.

OffsetDays
(optional)

Number of days that are added to the relative date (positive and negative numbers permitted). See RelativeDateOption.

OnlyVisibleDuringGeneration
(optional)

If true: The field is only displayed when the document is generated for the first time. If the user opens the Forms dialogue again in the primedocs ribbon in the open document, it is no longer displayed.

Content for Date

Element name

Description

Element name

Description

Description
(optional)

Additional information for the user filling out the form. Is displayed as a tooltip in the input interface.

ValidationMessage
(optional)

Text that is displayed to the user if this date field has been filled in invalidly.


YesNo

The YesNo element provides the user with the ability to check ("Yes") or uncheck ("No") an option in the input interface. Accordingly, it is typically displayed as a check box. A Check Box Content Control is inserted in the Word template.

Examples in XML with preview

Simple

Enhanced with adaptive data input

Attributes for YesNo

Attribute name

Description

Attribute name

Description

Id
(required)

Required for identification (insertion in template, use in scripts). Must not contain spaces and must be unique. Forms automatically adds the prefix Forms. (e.g. MustBeSigned becomes Forms.MustBeSigned).

Label
(required)

Label of the element in the input interface

Value
(optional)

If true: The YesNo option is enabled at the beginning

RequiredValue
(optional)

If true: The user must enable the YesNo option.
If false: The user must disable the YesNo option.
Recommended: Additionally configure a specific ValidationMessage.

OnlyVisibleDuringGeneration
(optional)

If true: The field is only displayed when the document is generated for the first time. If the user opens the Forms dialogue again in the primedocs ribbon in the open document, it is no longer displayed.

Contents for YesNo

Element name

Description

Element name

Description

ElementsIfYes
(optional)

Adaptive data entry: if the value is true, all forms elements entered between <ElementsIfYes> and </ElementsIfYes> are displayed.

ElementsIfNo
(optional)

Adaptive data entry: if the value is false, all forms elements entered between <ElementsIfNo> and </ElementsIfNo> are displayed.

Description
(optional)

Additional information for the user filling in the form. Displayed in the input interface (possibly as a tooltip).

ValidationMessage
(optional)

Text that will be displayed to the user if this text field was filled in invalidly.


Choice

The Choice element provides the user with the ability to choose between different options in the input interface. Accordingly, it is typically displayed as a drop down. A combo box content control is inserted in the Word template.

Examples in XML with preview

Simple

Erweitert mit adaptiver Dateneingabe:

Attributes for Choice

Attribute name

Description

Attribute name

Description

Id
(required)

Required for identification (insertion in template, use in scripts). Must not contain spaces and must be unique. Forms automatically adds the prefix Forms. (e.g. Classification becomes Forms.Classification).

Label
(required)

Label the element in the input interface.

Required
(optional)

If true: the user must select an option.
Recommended: Additionally configure a specific ValidationMessage.

SelectedValue
(optional)

Preselected option: The value that is in the Value attribute for the desired option must be specified here.

EmptyOptionLabel
(optional)

Label of the option symbolizing "nothing selected"

OnlyVisibleDuringGeneration
(optional)

If true: The field is only displayed when the document is generated for the first time. If the user opens the Forms dialogue again in the primedocs ribbon in the open document, it is no longer displayed.

Contents for Choice

Element name

Description

Element name

Description

Option
(required,
several possible)

Possible selection. At least one possible selection must be configured.
Attributes:

  • Value: Corresponds to Value of ComboBox-DataNode at Document Parameter.

  • Label: Corresponds to DisplayText of ComboBox-DataNode at Document Parameter.

Description
(optional)

Additional information for the user filling out the form. Is displayed as a tooltip in the input interface.

ValidationMessage
(optional)

Text that is displayed to the user if this selection is invalid.


AdditionalProfile

The AdditionalProfile element allows the user to select an additional profile. The profiles created by the user and the external profiles released to the user are displayed in a dropdown in the form and can be selected.

As a profile is based on the user and a user has various user fields (e.g. first name, telephone number, function, signature image, etc.), all user fields of a user are offered for insertion in the template. As a user field is either a text, a checkbox or an image, the corresponding content control can be inserted in the template.

Example

The most common case in which an AdditionalProfile is used is the signing of a document. For example, you would like to offer the user two AdditionalProfiles for a letter: the first with a pre-selection of their own profile and the second for the free selection of a co-signing person.

Attribute for AdditionalProfile

Attribute name

Description

Attribute name

Description

Id
(required)

Is required for identification (insertion in the template, use in fields). Must not contain spaces and must be unique. Forms automatically adds the prefix Forms. (e.g. Classification becomes Forms.Classification).

Label
(required)

Description of the element in the input interface

PreselectByIndex
(optional)

Requires the entry of an integer (1, 2, 3, ..., n).
If 1: The first profile stored in the signature profile is preselected.
If n: If one is stored, the nth profile in the signature profile is preselected.

Content for AdditionalProfile

Element name

Description

Element name

Description

Description
(optional)

Additional information for the user filling out the form. Is displayed as a tooltip in the input interface.


Objects, ObjectCollections und DataProvider

Object or ObjectCollection s can be defined to map objects such as a recipient, invoice items or any other data objects in the template.

An Object or an ObjectCollection is displayed in Forms as follows:

Attribute für Object bzw. ObjectCollection

Attribute name

Description

Attribute name

Description

Id
(required)

Is required for identification (insertion in the template, use in fields). Must not contain spaces and must be unique. Forms automatically adds the prefix Forms. (e.g. Classification becomes Forms.Classification).

Label
(required)

Description of the element in the input interface

Inhalte für Object bzw. ObjectCollection

Element name

Description

Element name

Description

Schema

Definiert alle benötigten Daten, die schlussendlich in einer Vorlage verwendet können sollen.

Summary

Definiert, welche Felder in der Listenansicht angezeigt werden sollen.

DataProviders
(optional)

Definiert Datenquellen, um Objekte z.B. von einem CRM, einer Web-API oder anderen Quellen zu laden.

Like any element, Objects oder ObjectCollections can be configured any number of ways. More information can be found on the Data interface page.

Beispiel Anwendungsfall Vorlage “Protokoll“

The following example shows the basic structure of an ObjectCollection. It consists of Schema, Summary as well as DataProviders:

XML-Konfiguration


Ãœbersetzungen

All the above-mentioned elements can be displayed with translation. If an attribute with the prefix translate- is used, the corresponding attribute does not have to be configured as well.

Translations are fetched from the Global Translations as follows:

Attribute name

Description

Attribute name

Description

translate-Label

(optional)

Translated label of the element in the input interface.

translate-Description

(optional)

Translated additional information for the user filling in the form. Displayed in the input interface.

translate-ValidationMessage
(optional)

Translated text displayed to the user if this selection was filled in invalidly.

translate-Value
(optional)

Translated, predefined value (depending on the element type) that the user can edit.

Application example from above with translated labels:


Glossary, Terms

Name

Description

Name

Description

Forms

Name of the new document function, formerly quasi "Document Parameter".

Forms dialog

Name for the new dialog, formerly quasi "Document Parameter dialog"

Form element

An input element in the Forms dialog, e.g. of type "Text" or "Choice

Structural element

Elements that are displayed in the Forms dialog but do not request input and therefore do not end up in the Document Part

Field

All form elements, which finally end up in the Document Part

Plain Text Content Control

Word content control that can only contain text

Date Picker Content Control

Word content control where a date can be selected

Check Box Content Control

Word content control with CheckBox icon that can be enabled and disabled

Drop-Down List Content Control

Word content control, where you can choose from predefined options

Combo Box Content Control

Word content control, where you can choose from predefined options and enter any text you want.

Object

An object is defined via a schema. Objects can be filled manually or via DataProvider.

ObjectCollection

A collection of objects. The difference to the object is that the list can store multiple objects of the same type.

DataProvider

Defines a source for objects.

Extensive example

Code

Forms

Felder

Screenshot

 

PrimeSoft AG, Bahnhofstrasse 4, 8360 Eschlikon, Switzerland