Fields in a form can be required or optional
Until now, when we fill in the gaps in a document manually, it was not always clear which data should appear mandatory and which should not.
This problem disappears with the use of forms, where the essential information is marked with an asterisk (*), to clearly differentiate it from that information that is optional.
In this example we can see how, thanks to the red asterisk, the mandatory fields are clearly distinguished. In addition, the software will check if all the required fields have been filled in and it will inform the user if this is not the case.
In the platform, the fields are created as mandatory by default, since most of the information that a document needs is essential.
Each field in the form has the choice of being optional. You can see an example of the option in the image below.
For this to be possible, you must prepare the Word document beforehand with the opening and closing tags. They are what will make this field optional. Let's see an example:
When we request the contact information of a person, depending on their nationality, they may have 1 or 2 surnames. Therefore, you should make the name and last name mandatory, and the second surname as optional.
As you have seen previously in the creation of simple tags, these are written in braces - e.g. {name} {surname1} {surname2} -. But to make the {surname2} optional we will have to create the opening and closing tags in order to condition it’s appearance or not in the document.
These, as they are tags for conditional texts, as we have seen so far, they are divided into 2 parts;
- The opening tag, which comes before the conditional text (in this case a tag that is conditioned) - is written with a hash in front {#tag} -
- The closing tag, which should be placed after the word - is written with a forward slash {/ tag} -
Result: {#tag} {tag} {/tag}
As a result, the document should be written as follows:
{name} {surname1} {#surname2}{surname2}{/surname2}
In other words, what we are indicating to the software is, in the place of the tag "name" insert the content of the field "name", in the place of the tag surname1" insert the content of the field "surname1", IF IN THE FORM the field "surname2" is FILLED (condition) then insert the content of the field "surname2" (which is the text that is as conditioned between the opening and closing tag) in the place of the tag "surname2".
Thanks to this composition, the document will automatically adapt to each case. It will only show the second surname when it is filled in the form.