In Infigo Designer, we support two types of text variables: Global and Local. Both of these variable types serve a similar purpose and can be placed within text fields, however they are subtly different.
Local variables can be used to allow your users to edit text within a field, without giving them access to the entire field. This can be useful in situations where you want a single text field to contain both static and variable text.
An example of when you would want to use this is if you were creating a business card, and you wanted to have the following labels:
You would want your users to be able to provide values for each of these, but you would not want them to be able to remove/change the labels. The best way to achieve this would be to create the static labels in the text editor, and then create a local variable for each of them.
To create a local variable, you will need to open your template in an instance of Adobe Acrobat which has Infigo Designer installed. After doing so, you will then need to create a text field or edit an existing one.
Once you have done so, you will need to enter the Field Settings for that field and then expand the Text Settings - this can be done by simply clicking on it.
From here, you will need to click on the Local Variables section. This will open a list of all local variables contained within the field. This is where the main difference between local and global variables comes in: local variables are localised to a single field, global variables are shared across the entire template.
To add a local variable, simply click 'Add...' and provide the variable with a name. The naming scheme for variables is similar to field names in that they must be unique from one another (within the same field), however variables are slightly more strict with their character restrictions. The variable names can only contain alphanumeric characters.
As you can see in the screenshot above, the variable will have its own set of properties. These properties are a condensed version of the Text Field property list, and will only affect the variable. This can be useful for many reasons, an example of which would be utilising the UIDescription property, allowing you to control how the field is titled in the editor.
In the second column of the Variables table, you will be able to enter a default value for the variable. This will pre-fill the variable field in the editor with the text provided, allowing you to give your users an example of what should go in the field.
Once you have configured your variable to your liking, you will need to add a placeholder for it in the Text Editor (if you want the variable to be seen in the editor and be a visible part of the output, that is).
To do so, navigate to the aforementioned Text Editor section, and select the variable you would like to add a placeholder for from the Local Variables dropdown highlighted below. Once you have selected your variable, click the 'Add' button adjacent to the dropdown and it will add a placeholder for the variable at the currently selected location in the text. This placeholder will always appear as <VariableName>, can be manually written, and there can be as many instances of the placeholder as you desire, all of which will contain the text entered into the same field in the form.
This placeholder will be replaced with whatever the user enters in the field in the form, however it will retain all formatting. This will allow you to control the font, alignment etc. of whatever the user enters by simply applying the desired result to the variable placeholder.
Creating and using a global variable is done through an almost identical process to creating and using a local one. You will need to do all of the steps you did for a local variable, except navigate to the Global Variables section instead of the Local Variables section. In the screenshot below, I have created a simple global variable.
As mentioned earlier, the difference between local and global variables is that local variables are localised to a single field, meaning that they only exist in that field, whereas global variables exist within the document. This allows global variables to be created once, only require the user to enter data into it once, and allow them to be present across multiple fields.
An example of where you may want this is if you are creating a multi-page letter template with the user's name being either entered or pre-populated as the variable data, and the user's name must appear multiple times on each page. The best way to do this would be to create a global variable and add the placeholders for this in the appropriate locations across all of the fields. This will mean that the user is only required to enter their data once and it will update in each instance of the variable throughout the template.
Once you have created and configured your global variable (through the same methods as with a local variable) you will need to add it to the Text Editor using the Global Variables dropdown instead of the Local Variables one. This is highlighted in the screenshot below, and you will also be able to notice that this is not in the field I created the global variable in, yet as it is a global variable it is still present.
Although you can create and manage global variables through a text field, you can also do this directly by navigating to Infigo Designer -> Manage Global Text Variables... and using the menu which this opens - both of these can be seen below.
I have saved this document and uploaded it to my storefront, and as you can see in the screenshot below, the placeholder text for both of the variables has not only been pre-filled and is rendered in the preview, but when I make changes to either of them the changes are reflected in each instance of their placeholders. To provide clarity, I have added a placeholder for the global variable into the text field containing the local variable as well.
I have attached the PDF I created through these steps to this article so that you may download it and have a working reference when creating your own global and local variables.