Step 3: Build a Form¶
In this step you build the Farm Visit form. Field staff complete it after they visit a farmer. One of its questions links the visit to a farmer who is already in the project, so you also need a Farmers table with some farmers in it.
Create the Farmers table¶
A form can create its own table, and for the Farm Visit form it will. The Farmers table is different. It is reference data that other forms link to, so create it first.
- In the main navigation, click Tables.
- Click Add new Data Table. Enter the Title Farmers and save.
- Open the table, then choose Structure in the dropdown next to its name at the top.
- Click Add New Field for each of these fields.
| Name | Label | Type |
|---|---|---|
| name | Farmer name | Text |
| village | Village | Text |
| phone | Phone number | Text, sub-type Phone number |
Note
Village is a Text field here, to keep the example short. If you later want each field officer to see only their own villages, make Village a Relation to a Villages table from the start. Data scoping needs a reference table, and changing a field's type after you collect data may not fit the stored values. See Groups and Data Scoping.
- Go back to the Tables page, click the table's edit button, and set Display Fields to Farmer name. A farmer then appears by name wherever another record links to them.
- Open the table and click Add New Record to add three or four farmers by hand. Or import them from a spreadsheet. See Importing Data.
Create the form¶
- In the main navigation, click Forms.
- Click Add New Form.
- Enter the Title Farm Visit. Leave Create a new data table selected, so the form makes its own table.
- Leave Automatically approve submissions off. In step 5 you review a submission before it becomes a record.
- Click Create. Then open the form's structure page with the purple wrench button on its row.
See Creating a form for every setting.
Add the questions¶
Click Add New Input for each question. Enter the Name, the Label and the Type, and the other settings in the table.
| Name | Label | Type | Other settings |
|---|---|---|---|
| farmer | Which farmer did you visit? | Relation | Table: Farmers. Required. |
| visit_date | Date of visit | Date | Validation: Only past date. Required. |
| crop_condition | Condition of the main crop | Select One | Options: Good, Fair, Poor. Enter each word as both the Label and the Value. Required. |
| area_ha | Area inspected (hectares) | Decimal | Validation: Min 0, Max 50. |
| photo | Photo of the plot | Image | |
| location | Location of the plot | GeoLocation | |
| notes | Notes | Long Text |
Each type is explained in Input Types. Two of them do most of the work in this form.
- Relation links the visit to a Farmer record. The user picks the farmer from a list, so the name is always spelt the same way.
- Select One gives three fixed answers for the crop condition. Later, the dashboard counts visits by condition, which is only possible because the answers are fixed.
Try the form¶
Click View Form near the top of the Form Structure page. The form opens in a new tab. Check that each question appears as you expect, then close the tab. Do not submit it yet.
Tip
Drag a question by its three-line handle to change the order. See Rearranging questions.
Publish the form¶
Field staff use the 3D app, and the app does not download a form whose status is Draft.
- Go back to the Forms page.
- Click the edit button on the Farm Visit row.
- Set Status to Published and save.
What you have¶
- A Farmers table with a few farmers.
- A Farm Visit form with seven questions, linked to its own Farm Visit table.
- The form is published, so it is ready for the app.
Next: Step 4: Collect data.