Skip to content

Form Concepts

This page explains the concepts 4HSE forms are built on. To add logic to a form with JavaScript see Coding Forms; to use the tools a form is built with see Simple Form Editor and Advanced Form Editor. For the user guide see Forms.

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.

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

The metadata tell when and where the form is offered:

MetadataWhat it says
Name and descriptionhow the form presents itself when it is chosen
Tagslabels to filter the list of forms
Launch pointsthe places in the app the form is offered from
Country and languagefor people working in which country and language the form is offered

Launch points are the same as for reports: see 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. 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.

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.

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.

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.

A form is built with one of two editors:

Simple editorAdvanced editor
Structurea list of fields, one below the othercomponents placed freely, also side by side, with rows, columns and tables
Available fields7 types: checkbox, text, text area, dropdown, single choice, multiple choice, signatureevery component, with every property configurable
Preview and undonoyes
When to use ita simple checklist or registera document with a particular layout

A form opens again in the editor it was created with. See Simple Form Editor and Advanced Form Editor.

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 and Terms of Service apply.