Skip to main content

Form

Last updated 14/01/2026

Form Object

The

Form
object allows to represent a form user interface and its fields, allowing your code to read from and react to input. It provides the connection between the user interface and your application's logic.

In Five, all events have an instance of the

object as the initial parameter, and this provides a function called

sender() : any
. Using this function we can get the current form in many situations, below are scenarios depending on the appropriate event:

  • If an event attached to a form is called (ie,
    OnShow
    ), the current form will be
    five.sender()
    ;
  • If an event attached to a form page is called (ie,
    OnLeaving
    ), the current form will be
    five.sender().getParent()
    ;
  • If an event attached to a form field is called (ie,
    OnExit
    ), the current form will be
    five.sender().getParent().getParent();

If you are in subforms, you can further call

to move up the form hierarchy if needed.

What the Form Object Does

  • Holds the current values entered into the form fields
  • Lets you get field values programmatically
  • Allows validation of user input
  • Triggers logic when fields change or a form is submitted (saved)

How the Form Object Fits into an Application Flow

A typical lifecycle looks like this:

  1. Form loads - fields are populated from data or defaults.

  2. User interacts - by typing, selecting, or changing values.

  3. Form object - values are stored internally, and form events are attached.

  4. Your code reacts - it runs the logic, updates other fields, and shows messages or errors.

  5. Form submits - final validation occurs, and data passed to the backend or workflow.

Summary

The

Form
object is not just data, it is behavior + state + interaction. It allows you to treat the form as a programmable object, keep the UI and logic cleanly connected, and build responsive, rule-driven user experiences.

Functions on the Form Object

The following functions are available on the

Form
object.

actionID()

The

is a function on the

Form
object that returns a string identifier for the action associated with that form. It is used to differentiate forms in your code based on the action they represent. It's specifically limited to forms and is used to control logic, UI, or behavior based on that action.

Available: Client

JavaScript
Function Signature
actionID() : string;

Return value: A string representing the unique identifier for the form action.

Examples:
actionID()

event()

The

is a function on the

Form
object that returns the ID of the event that caused the form event logic to run, such as
OnShow
. Effectively, it tells you why the form code is executing.

Available: Client

JavaScript
Function Signature
event() : string;

Return value: A string representing the ID of the event that triggered the form logic.

Examples:
event()

getPage()

The

is a function on the

Form
object that returns a
FormPage
object that represents any page on a form. Many forms in Five are split into pages,
getPage()
gives you access to specific pages so you can work with them in code.

Available: Client

JavaScript
Function Signature
getPage(pageID: string) : FormPage;

ParameterTypeDescription
pageID
stringThe Page ID for the page

Return value: A

FormPage
object that represents any page on a form.

Examples:
getPage()

getParent()

The

is a function on the

Form
object that returns another
Form
object, specifically, the parent form of the current form if it exists.

By returning another form, it allows you to move up the form hierarchy. Forms in Five are nested, within a form, there is a main form that can have sub-forms,

getParent()
lets you navigate upward in this structure.

Available: Client

JavaScript
Function Signature
getParent() : Form;

Return value : A

Form
object for the parent form of the current form.

Examples:
getParent()

getValue()

The

is a function on the

Form
object that reads or retrieves the current value of a field on the form. It does not modify the field, it only reads the value in the field.

getValue()
is used for the entire form, if you have multiple pages/sub-forms on a form, the first unique identifier for a field will be used. In the event of duplicate field IDs on a form, it is recommended to use:
getPage("PageID").getField.("FieldID").getValue()

Available: Client

JavaScript
Function Signature
getValue(fieldID: string) : any;

ParameterTypeDescription
fieldID
stringThe Field ID for the form field

Return value : Any value stored in the field, it can be a string, number, boolean, object, date, null/defined etc.

Examples:
getValue()

isCreate()

The

is a function on the

Form
object that tells you whether the form is currently being used to create a new record. It returns
true
when the form is in create mode (new record), and returns
false
when the form is not creating a new record (eg. editing or viewing an existing record).

Available: Client

JavaScript
Function Signature
isCreate() : boolean;

Return value : boolean,

true
for create or
false
for not create.

Examples:
isCreate()

refresh()

The

is a function on the

Form
object that reloads or updates the form with the latest data. Effectively, ensuring everything is up-to-date on the form.

The optional parameter gives you control over how much of the form hierarchy gets refreshed, but you don't have to provide it if you only care about the current form.

Available: Client

JavaScript
Function Signature
refresh([includeParents]) : void;

ParameterTypeDescription
includeParents
booleanOptional: Refresh this form and all parents in the hierarchy

Return value : void, this function does not return a value back to the caller.

Examples:
refresh()