---
title: "Simple Form Editor"
url: "https://dev.4hse.com/guides/forms/simple-form-editor"
description: "Guide to the 4HSE simple form editor: building a form as a list of fields, the field identity that scripts refer to, the configuration dialog (details, appearance, script) and saving."
---

# Simple Form Editor

The **Simple editor** builds a [form](/guides/forms/coding-forms/) 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](/guides/forms/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](/guides/forms/coding-forms/).

## Open the editor

[Section titled “Open the editor”](#open-the-editor)

-   **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](/guides/forms/advanced-form-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

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

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

Control

What 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](#saving)

**Configuration** (gear)

opens the [configuration dialog](#configuration)

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](/_astro/simple-form-editor-window.D2_iVEWR_24dIx5.webp)

## The fields

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

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

Button

Field

Answer of the person filling in

**\+ Checkbox**

a box to tick

ticked or not

**\+ Text input**

a single-line text

a short text

**\+ Text area**

a multi-line text

a longer text

**\+ Dropdown**

a drop-down list

one of the options

**\+ Single choice**

options shown together

one of the options

**\+ Multiple choice**

options shown together

one or more of the options

**\+ Signature**

a drawing area

a 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.

### Field identity

[Section titled “Field identity”](#field-identity)

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.

Value

Used for

**Widget Id**

the script finds the field with `this.getWidget('<Widget Id>')`, and the handlers are named after it, such as `<Widget Id>OnChange`

**Name**

the 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.

### The value of a field in a script

[Section titled “The value of a field in a script”](#the-value-of-a-field-in-a-script)

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](/guides/forms/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.

## Configuration

[Section titled “Configuration”](#configuration)

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.

### Details

[Section titled “Details”](#details)

The **Details** are the [metadata](/guides/forms/form-concepts/#metadata) of the form. These are the rules of the editor:

![The Details tab of the Configuration dialog, with every field filled in](/_astro/simple-form-editor-details.BWuC2ILI_Z23xTER.webp)

Field

Rule

**Name**

**Required.** The form cannot be saved without it

**Tag**

Optional

**Launch points**

A form with no launch points is never offered: it can only be opened from the file system

**Country**, **Language**

See [Country and language](https://docs.4hse.com/forms/#country-and-language-filter-the-list) in the user guide

**Description** is optional.

### Appearance

[Section titled “Appearance”](#appearance)

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:

Option

Effect

**Header**

**Standard**: the project’s logo and name and the office details. **Custom title**: a **Title** and a **Subtitle** that you type. **None**: nothing

**Show entity descriptor**

adds a short description of the item the form is filled in from, for example the person or the session date

**Show date**

adds the completion date

**Show time**

adds the completion time. Available only with **Show date**

**Prefill with current date/time**

fills date and time in when the form opens. Available only with **Show date**

**Read-only**

the 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.

### Script

[Section titled “Script”](#script)

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](/guides/forms/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';  }}
```

## Saving

[Section titled “Saving”](#saving)

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](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms) apply.