Adding Forms
Last updated 29/06/2022
Creating Forms in Five
The following documentation will explain the general steps to create a form for your application. Further documentation will need to be read to have an understanding of how you can turn your forms into highly complex event-driven forms.
General Steps to Add a Form
Requirements
- The role of Developer or Control
- To create a form you will need at least one page and one form field.
- At least one form field will need to be mandatory and included in the list.
- The first page of your form have a Form page type.
Prerequisite
- Your tables are established in Five.
Steps
Select Forms in the menu.
Click the Add Item button in the list app bar.
Type a title in the Title field.
Click the lookup icon in the Table field and select the required table.
Click the Pages tab.
- Click the Add Pages button.
Type a caption in the Caption field.
Click the Fields tab.
- Click the Add Fields button.
Click the lookup icon in the Field field and select the table field.
Type a caption in the Caption field.
Click the lookup icon in the Display Type field and select the required display type.
Click all three Save buttons in the stacked form app bars.
Below is a quick video demonstrating adding a form in Five.
Add Multiple Pages to a Form
Requirement
- The first page must have a page type of Form and have at least one field saved for the page.
Prerequisite
- The General page details are completed.
Steps
Click the Add Pages button.
Type a caption in the Caption field.
Use the lookup icon in the Page Type field and select the required page type.
Use the lookup icon in the Action field and select the Action ID to reference.
A page type of Form does not need to reference an action in Five.
Click the Save button in the form app bar.
Repeat for the number of pages required.
Click both Save buttons in the stacked form app bars after saving your final page.
Add Multiple Fields to a Form Page
Prerequisites
- The General page details are completed.
- The page that the fields are being added to must have a Form page type.
Steps
Click the Add Fields button.
Use the lookup icon in the Field field and select the table field.
A field does not need to be selected if you do not need to store the data in the database.
Type a caption in the Caption field.
Use the lookup icon in the Display Type field and select the display type.
Click the Save button in the form app bar.
Repeat for the number of fields required.
Click all three Save buttons in the stacked form app bars after saving your final field.
Create a Form with a Dependent Table
The Dependent Table field will only list tables that have a dependency established in the database. If there are no dependent relationships in your database the lookup list will display 'No Options'.
Five supports the object-relational mechanism known as inheritance. Inheritance allows a table to inherit some of its column attributes from another table creating a parent-child relationship. This causes the child table to have each of the same columns and constraints as its inherited table as well as its own defined columns.
When selecting a dependent table in Five you will have access to the fields from both tables to select for your form.
Example
The following diagram shows the child entities inherit all the elements of their parent entity, plus have some additional ones unique to themselves. The parent entity takes on a 'Type' column to show what type of entity it is. In the diagram below, we can see the Entity table has three dependent tables. The EntityType column in the Entity table is to store which type of entity it is.
The Customer table has a dependent relationship with the Entity table. Inheritance is the mechanism that connects the Customer table to the Entity table, allowing the Customer table to automatically acquire the Entity (parent) table's properties and methods.
Requirements
- The main table must have a 'Type' field. The type indicator is a mechanism for determining the type of entity. For example, the Entity table may include an indication of whether the entity represented by the table row is a customer, motor dealer or contact.
- The Type field on the form requires a default value to be stored in the database's main table (Entity table). For example, C for customer.
- The Show If field for the Type field needs to be false to hide the field on the form.
Prerequisite
The dependent relationship must be established at the table-level.
Steps
Click the Add Item button in the list app bar.
Type a title in the Title field.
Use the lookup icon in the Table field and select the parent table. For this example, the Entity table.
Use the lookup icon in the Dependent Table field and select the dependent table. For this example, the Customer table.
Click the Pages tab.
- Click the Add Pages button.
Type a caption in the Caption field.
Click the Fields tab.
- Click the Add Fields button to add the type field.
Use the lookup icon in the Field field and select the table field. For this example, the EntityType field.
Type a caption in the Caption field. For this example, Type.
Click the Include In List switch to remove from a true state.
Type false in the Show If field.
Use the lookup icon in the Display Type field and select _Text.
Type a value to be stored in the database in the Default Value field. For this example, C.
Click the Save button in the form app bar.
- Click the Add Fields button.
Repeat for the number of fields required for the form.
Click all three Save buttons in the stacked form app bars after adding your final field.
- The Field field will hold all the fields from both of the tables.
- Ensure you have at least one field included in the list if your 'Type' field is the first field on the form.