Skip to main content

Instance class

๐Ÿ“– Descriptionโ€‹

The Instance class holds all the data of a single active form instance. It manages the progress in the virtual finite state machine that is generated by the Runner class for the supplied form definition. The instance also contains the actual data that is collected by the form.

info

You always need to use the start or restore method of the Runner class to construct new form instances.

If you use one of the stock runners, instances are constructed automatically for you.

๐Ÿ—ƒ๏ธ Fieldsโ€‹


๐Ÿท๏ธ checksumโ€‹

Retrieves a checksum for the form instance.

Typeโ€‹

string


๐Ÿท๏ธ dataโ€‹

Retrieves the collected data for the form.

Typeโ€‹

Data


๐Ÿท๏ธ fingerprintโ€‹

Retrieves the fingerprint of the form.

Typeโ€‹

string

tip

More information in the form fingerprint guide.


๐Ÿท๏ธ finishReferenceโ€‹

Retrieves the optional reference that is returned by the finish event handler (for example, the server identifier of the form submission).

Typeโ€‹

string


๐Ÿท๏ธ hasDataCollectedโ€‹

Retrieves if the form has any data collected.

Typeโ€‹

boolean


๐Ÿท๏ธ idโ€‹

Retrieves the form instance identifier.

Typeโ€‹

string


๐Ÿท๏ธ isAtFinishโ€‹

Retrieves if the form instance is at the finish.

Typeโ€‹

boolean


๐Ÿท๏ธ isAtHeadโ€‹

Retrieves if the form instance is at the head, which is the furthest point in the form that has been reached.

Typeโ€‹

boolean


๐Ÿท๏ธ isAtStartโ€‹

Retrieves if the form instance is at the start (the beginning of the form).

Typeโ€‹

boolean


๐Ÿท๏ธ isFinishableโ€‹

Retrieves if the form instance is finishable using the finish method. This means the form is at the end and passes validation.

Typeโ€‹

boolean


๐Ÿท๏ธ isFinishedโ€‹

Retrieves if the form instance has finished.

Typeโ€‹

boolean


๐Ÿท๏ธ isFinishingโ€‹

Retrieves if the form instance is finishing.

Typeโ€‹

boolean


๐Ÿท๏ธ isInitializedโ€‹

Retrieves if the form instance is initialized.

Typeโ€‹

boolean


๐Ÿท๏ธ isPausedโ€‹

Retrieves if the form instance is paused.

Typeโ€‹

boolean


๐Ÿท๏ธ isPausingโ€‹

Retrieves if the form instance is being paused.

Typeโ€‹

boolean


๐Ÿท๏ธ isPreviewโ€‹

Retrieves if the preview mode is enabled for the form instance.

Typeโ€‹

boolean


๐Ÿท๏ธ isRunningโ€‹

Retrieves if the form instance is running.

Typeโ€‹

boolean


๐Ÿท๏ธ isStoppedโ€‹

Retrieves if the form instance is stopped.

Typeโ€‹

boolean


๐Ÿท๏ธ l10nโ€‹

Retrieves the localization namespace with helper functions for working with translations and locales.

Typeโ€‹

L10n.Namespace


๐Ÿท๏ธ snapshotโ€‹

Retrieves the instance snapshot.

Typeโ€‹

IInstanceSnapshot

โ–ถ๏ธ Methodsโ€‹


๐Ÿ”ง finishโ€‹

Finish the form instance when it is at the end and there are slots collected.

Signatureโ€‹

finish(): Promise<void>

Return valueโ€‹

Returns a Promise that resolves when the form is finished or rejects when the form could not be completed.


๐Ÿ”ง pauseโ€‹

Pauses the instance.

Signatureโ€‹

pause(): IInstanceSnapshot | undefined

Return valueโ€‹

Returns the IInstanceSnapshot object or undefined if the instance could not be paused or was not running.


๐Ÿ”ง restartโ€‹

Restarts the form instance.

Signatureโ€‹

restart(): void

๐Ÿ”ง startโ€‹

Starts the form instance.

Signatureโ€‹

start(): boolean

Return valueโ€‹

Returns true if the instance is started.


๐Ÿ”ง stencilโ€‹

Calculates the form stencil hash for the specified type. The form data stencil is a set of two hashes calculated from the form definition. Those data stencil hashes remain stable as long as the data fields generated when running the form definition remain the same. This is different than the fingerprint hash, which remains stable as long as the structure of the form stays the same.

Signatureโ€‹

stencil(type?: "exportables" | "actionables"): string

Parametersโ€‹

NameTypeOptionalDescription
type"exportables" | "actionables"YesSpecifies the stencil type. It can be one of the following values:
- exportables: Generates the hash for all exportable fields (this is the default type);
- actionables: Generates the hash for all actionable fields.

Return valueโ€‹

Returns the stencil hash.

tip

More information about the stencil hashes in the form data stencil guide. More information about exportable vs. actionable data can be found here.


๐Ÿ”ง stepBackwardโ€‹

Step backward in the form.

Signatureโ€‹

stepBackward(): boolean

Return valueโ€‹

Returns true if the step succeeded.


๐Ÿ”ง stepForwardโ€‹

Step forward in the form.

Signatureโ€‹

stepForward(): boolean

Return valueโ€‹

Returns true if the step succeeded.


๐Ÿ”ง stepToHeadโ€‹

Step to the head of the form. This is the furthest point in the form that has been reached.

Signatureโ€‹

stepToHead(): boolean

Return valueโ€‹

Returns true if the step succeeded.


๐Ÿ”ง stepToStartโ€‹

Step to the beginning of the form.

Signatureโ€‹

stepToStart(): boolean

Return valueโ€‹

Returns true if the step succeeded.


๐Ÿ”ง stopโ€‹

Stops the instance.

Signatureโ€‹

stop(): boolean

Return valueโ€‹

Returns true if the instance was running and is stopped.