Skip to content

Simple Form Editor

The Simple editor builds a form as a list of fields, one below the other. You add the fields, write the question of each one, and set the header and the completion date in a configuration dialog. It is the quickest way to get a checklist or a register on screen. When the form needs fields side by side or a custom layout, use the Advanced Form Editor.

This page describes what the editor shows and what you can do with it. For the JavaScript that gives a form its behaviour, see Coding Forms.

  • A new form. In the file manager of an office or project, click the New icon and choose New form (simple editor).
  • An existing form. In the file manager, select the .hf file and click Modify, or right-click it and choose Modify. A form made with the simple editor opens here; any other form opens in the advanced editor.

The title of the window is Customize: followed by the name of the form. A new form starts with the name No name.

The window has a toolbar at the top and, below it, the list of fields with the buttons that add them.

ControlWhat it does
Save (floppy disk, with a menu)Save overwrites the file, Save as saves it with another name or in another folder. See Saving
Configuration (gear)opens the configuration dialog

The editor has no preview and no undo: the form is saved when you save it, and you check it by filling it in.

The simple editor with three fields and, below them, the buttons to add more

Each button below the list adds a field of that type at the end of the list:

ButtonFieldAnswer of the person filling in
+ Checkboxa box to tickticked or not
+ Text inputa single-line texta short text
+ Text areaa multi-line texta longer text
+ Dropdowna drop-down listone of the options
+ Single choiceoptions shown togetherone of the options
+ Multiple choiceoptions shown togetherone or more of the options
+ Signaturea drawing areaa signature

Every field has:

  • the question, the text the person filling in reads (Type your question here);
  • an optional description, shown below it, to guide the answer (Type your description here);
  • for Dropdown, Single choice and Multiple choice, the Options: click Add for each answer and type its text. The × removes an option.

The first line of a field shows its type. The row actions of the field (reorder, delete and the Field identity gear) are described in the user guide.

A script finds a field by its identity, so every field has two values you can read and change: the Widget Id and the Name. The editor gives a new field the identity <type>_<number>: text_1, text_2, dropdown_1, checkbox_group_1.

To change it, click the gear of the field: the Field identity dialog opens.

ValueUsed for
Widget Idthe script finds the field with this.getWidget('<Widget Id>'), and the handlers are named after it, such as <Widget Id>OnChange
Namethe name of the field in the form: the other widgets and the data of the form refer to it

Rules:

  • Both values contain only letters, numbers and underscores, and do not start with a number. A hyphen is not accepted, because the Widget Id becomes part of a function name.
  • Both values are unique in the form: a Widget Id or a Name already used by another field, as either of its two values, is rejected and the dialog stays open.

Choose a meaningful identity before you write the script (is_anonymous is easier to read than checkbox_3) and then leave it alone: the script refers to it.

In a script the answer of a field is its data. In a form made with the simple editor:

  • a checkbox, a text input, a text area: the same values as in Coding Forms;
  • a dropdown, a single choice: the position of the chosen option, counted from 0: the first option is 0;
  • a multiple choice: an array with the positions of the checked options.

The value of an option is its position in the list, so adding or removing an option in the middle changes the value of the options after it. Change the options of a form that is already in use with care, and check the script that compares them.

The Configuration dialog has three tabs. Confirm applies the changes to the form being edited: they are written to the file when you save it. Cancel discards them. Confirm does not close the dialog while the name is empty.

The Details are the metadata of the form. These are the rules of the editor:

The Details tab of the Configuration dialog, with every field filled in

FieldRule
NameRequired. The form cannot be saved without it
TagOptional
Launch pointsA form with no launch points is never offered: it can only be opened from the file system
Country, LanguageSee Country and language in the user guide

Description is optional.

What is shown around the fields. A new form starts with the standard header, the entity descriptor, and the date and time shown and prefilled; Read-only is off:

OptionEffect
HeaderStandard: the project’s logo and name and the office details. Custom title: a Title and a Subtitle that you type. None: nothing
Show entity descriptoradds a short description of the item the form is filled in from, for example the person or the session date
Show dateadds the completion date
Show timeadds the completion time. Available only with Show date
Prefill with current date/timefills date and time in when the form opens. Available only with Show date
Read-onlythe person filling in cannot change date and time. Available only with Prefill with current date/time

A dependent option is hidden when the one it depends on is off, and keeps its value for when you turn it on again.

The Script tab holds the form’s JavaScript: the Script field opens a code editor (Form script). Under it, the Quick guide gives a reminder of the naming rule (onInit, <widgetId>On<Event>), the list of the ids of the fields of the form right now (No fields added yet when there are none), and the data available in the code (this.root, this.getWidget(widgetId), this.runtime.context, this.runtime.target).

The language of the script, the events and the API are described in Coding Forms.

Example. In the Script tab, with the text field operator_name:

function onInit(event) {
const operator = this.getWidget('operator_name');
if (operator) {
operator.placeholder = 'Name and surname';
}
}

Click Save to open the menu:

  • Save as opens the file picker. It shows only the folders you can write to, and saves a .hf file. After the first save, the editor keeps working on the new file.
  • Save overwrites the file the editor is working on: the file the form was opened from, or the one chosen with Save as. It is not available for a new form that was never saved.

A form that comes from outside the project (the 4HSE catalogue or a partner’s) and was opened from the form wizard cannot be overwritten: Save is disabled until you use Save as in a folder of the project. The original stays as it was.

A form cannot be saved without a name: the editor says so and does not save.

The editor builds the form again from its fields and from the configuration every time it saves. If you open in the simple editor a form that was edited by hand or in the advanced editor, only what the simple editor knows how to show is kept: the supported fields, the header, the entity descriptor, the completion date and the script. To keep a layout that the simple editor cannot show, edit that form only with the advanced editor.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.