On-boarding form (part 1): Creating a fragment

Applies to Infiniti v9.1 or later
 

Overview

 
In this exercise we will be building an On-boarding form that anyone starting at a new company would use.
 
This guide assumes you have already completed the Creating an Infiniti project - Quick-start guide project and understand the fundamentals of Infiniti.
 
The first part of the guide will get you to build a fragment, a feature that is new with Infiniti version 9.
  • What is a fragment?
A fragment is like a normal project except it cannot run by itself and must be placed in other projects to work.
  • Why is this useful?
If you have multiple projects which have portions similar or the exact same layout, a fragment can be made to replace the need for recreating that similar layout multiple times. Fragments also allow multiple people to work on different parts of a project at the same time.
 

Creating our first fragment

 
  • In Manage click Design and click Create new project.
  • In the New Infiniti Project Window, choose Fragment Portion for Project Type. Call the New Project Name: Fp_PersonalInformation, and click No document. Click OK.
For fragment naming conventions, Fragment Pages should start with ‘FP_’ and Fragment Portions should start with ‘Fp_’.
 
 
 
The project will look different.
 
 
 
As you can see there are 3 fields. Inputs, Layout and Outputs:
  • Inputs allow data outside of the fragment to be pushed in. We will not be focusing on Inputs in this fragment.
  • Layout is where all your questions are placed.
  • Output is where you collect the data to use elsewhere in the project hosting the fragment.
 
Create the layout to look like this. We will be adding extra variables to each question later.
 
 
 
  • After you have created all the questions and have named them appropriately, we will be adding extra settings for each field.
  • First Name: Click the answer and change the Document Format to Uppercase First Letter (+-).
  • Last Name: Click the answer and change the Document Format to Uppercase First Letter (+-).
  • State:  For every answer, change the Value to whatever the state is called.
  • State variable: In the answer formula, type in Concat([q3]). Concat concatenates a question getting all the active values in the selected question.
  • If State’s question Id is not q3, then change it to whatever State’s question Id is.
  • Address: Click the answer and change the Document Format to Propercase (+-+-)
  • Post Code: Click the column which Post Code is in and change the Column Properties to Width: 150 Pixel.
 
  • Click on Post Code and in the Properties tab chance the Character Limit to 4. In the Validation Tab change the Type to Regular Expression. In the Expression, type in ^[0-9]{4} and add the message “Must only contain 4 numbers” like the image below.
 
 
The Expression ^[0-9]{4} Makes it so that it only accepts exactly 4 numbers. The reason why we use this expression instead of changing the data type to numbers in the Properties tab is because the Numbers Data Type only takes numbers as a value, instead of a string. This means values with zero at the start will the next value that isn’t zero. Example would be 0123 being the same as 123.
 
  • Home Phone: Click on Home Phone and in the Properties tab change the Character Limit to 10. In the Validation Tab change the Type to Regular Expression. In the Expression, type in ^[0-9]{8,10} and add the message “Must only contain 8 to 10 numbers”.
  • Mobile Phone: Click on Mobile Phone and in the Properties tab change the Character Limit to 10. In the Validation Tab change the Type to Regular Expression. In the Expression, type in ^[0-9]{10} and add the message “Must only contain 10 numbers”.
  • Email: Click on Email and in the Properties tab change the Data Type to Email. In the Watermark type in “name@server.com”.
Now that we have configured the questions in a way we want them to we are now going to add some outputs.
  • Drag and drop an Output into the Question Set. Click it and in the Output Name type in First Name. In Question chose First Name and in Answer choose firstname. Do this in a similar fashion for every question except for State, use State variable instead.‚Äč
 
 
  • Click Save and exit out.
 
Testing our Fragment
 
Now that we have created our fragment we should test it out to see if everything is working correctly. Fragments cannot be published because they cannot run by themselves.
  • Create a new Project and call it testing_fragment.
  • Drag and drop a Fragment into the Question set and choose Fp_PersonalInformation.
 
 
  • Click save and publish this project. Run the project on produce and you will see your fragment in action.
  • Go back to testing_fragment. Click on edit template and add these placeholders into your empty document.
                    {{firstname}} {{lastname}} {{state}} {{address}} {{postcode}} {{homephone}} {{mobilephone}} {{email}}
  • Save the word document and then the project. Click the placeholders tab and drag and drop the place holders to the output which fits them the most. Click save after this is done.
 
  • Run the project once again in produce and fill out all the questions. Submit the form and download the document. You will see all the values you inputted into the document.
 
Congratulations you have just created a working fragment. We will be using the fragment later.
 
The fragment dynamically updates in every projects it is in. So, it is important to not be careless changing the fragment when it is being used in multiple projects.