---
title: "Form Concepts"
url: "https://dev.4hse.com/guides/forms/form-concepts"
description: "The concepts behind 4HSE forms: what a form is, its parts (metadata, widgets, id and name, script), the two editors and how a form runs."
---

# Form Concepts

This page explains the concepts 4HSE forms are built on. To add logic to a form with JavaScript see [Coding Forms](/guides/forms/coding-forms/); to use the tools a form is built with see [Simple Form Editor](/guides/forms/simple-form-editor/) and [Advanced Form Editor](/guides/forms/advanced-form-editor/). For the user guide see [Forms](https://docs.4hse.com/forms/).

## What is a form

[Section titled “What is a form”](#what-is-a-form)

A **form** is a document that people fill in on screen: a register, a checklist, a report to compile. A form is a JSON file with the `.hf` extension, built with one of the two editors. The difference between a form and a filled-in form is in the user guide: [Forms](https://docs.4hse.com/forms/).

## The parts of a form

[Section titled “The parts of a form”](#the-parts-of-a-form)

A form is made of four parts: metadata, widgets, widget id and name, and script.

### Metadata

[Section titled “Metadata”](#metadata)

The **metadata** tell when and where the form is offered:

Metadata

What it says

**Name** and **description**

how the form presents itself when it is chosen

**Tags**

labels to filter the list of forms

**Launch points**

the places in the app the form is offered from

**Country** and **language**

for people working in which country and language the form is offered

Launch points are the same as for reports: see [Launch points](/guides/reports/report-concepts/#launch-points). A form with no launch points is never offered: it can only be opened from the file system. See [Launch points decide where a form appears](https://docs.4hse.com/forms/#launch-points-decide-where-a-form-appears). Country and language are permissive filters, as in reports: if empty, the form is valid in every country and every language. See [Country and language](https://docs.4hse.com/forms/#country-and-language-filter-the-list).

### Widgets

[Section titled “Widgets”](#widgets)

A form is made of **widgets**: rows and columns that arrange the contents, texts, and input fields (text boxes, dropdowns, checkboxes, dates, signatures). There are also ready-made blocks of 4HSE, such as the header with the logo or the attendance register. The field types of the simple editor are described in [Simple Form Editor](/guides/forms/simple-form-editor/#the-fields).

### Widget id and name

[Section titled “Widget id and name”](#widget-id-and-name)

Every widget has an **id** (its identifier in the form, unique) and, if it is a field, a **name**. The script finds a widget by its id, and the name of the event handlers comes from it. For this reason the id contains only letters, numbers and underscores, and does not start with a number.

### Script

[Section titled “Script”](#script)

The **script** gives the form its behaviour: it fills in fields when the form opens, shows or hides a group of fields according to an answer, loads data from 4HSE. It is a set of JavaScript functions, attached to the widgets by their name (`onInit`, `<id>OnChange`…). How to write it is explained in [Coding Forms](/guides/forms/coding-forms/).

## The two editors

[Section titled “The two editors”](#the-two-editors)

A form is built with one of two editors:

Simple editor

Advanced editor

**Structure**

a list of fields, one below the other

components placed freely, also side by side, with rows, columns and tables

**Available fields**

7 types: checkbox, text, text area, dropdown, single choice, multiple choice, signature

every component, with every property configurable

**Preview and undo**

no

yes

**When to use it**

a simple checklist or register

a document with a particular layout

A form opens again in the editor it was created with. See [Simple Form Editor](/guides/forms/simple-form-editor/) and [Advanced Form Editor](/guides/forms/advanced-form-editor/).

## How a form runs

[Section titled “How a form runs”](#how-a-form-runs)

When a person opens a form, 4HSE runs these steps, in order:

1.  The **widgets** are built, and the form appears on screen.
2.  The **functions of the script** are attached to the widgets according to their name.
3.  **`onInit`** runs: it can already change the widgets.
4.  The person fills in the form. When a widget triggers an event (for example a change of value), the function attached to that event runs.

An error in a function does not stop the form: it is written in the console of the browser.

This site is protected by reCAPTCHA and the Google [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms) apply.