Field Object

Field objects are the primary mechanism for accessing and manipulating field data and properties. They can be accessed via the Context API.

Field PropertyTypeDescription

value

optional polymorphic: boolean | string | string[] | number | number[] | Promise | Promise[] | Record<string, any>

Read/write property for getting or setting the field value. The type of the value varies depending upon the field type.

The value is an array type for multi-valued field types (e.g. multi select, etc.) or if the field is repeating.

null if no submission, Promise<File> if file submission, Base64 string if signature.

required

boolean

If the field must be filled out before submitting. Read/write property.

disabled

boolean

If the field is disabled or interactable. Read/write property.

options

string[] | { value: string; label ?: string; image ?: string }[]

Allowed options to choose from, if the field specifies them (e.g. dropdown, radio buttons, etc.).

Read/write property.

type

string enum

The field type (e.g. textarea, checkbox, etc.). Only available for fields on the loaded form.

Read-only property.

displayText

optional string

The text to display to your user along with the field

Read-only property.

onThisForm

boolean

True if this field appears on the loaded form. False if the field is from another form.

Read-only property.

isHiddenField

boolean

True if this field is one of the special 'hidden' fields that do not appear on a form. False if this field is a regular form field.

Read-only property.

placeholder

string

The placeholder text for the field that is shown when the field has no value.

Read/write property.

setStyles()

(styles: Record<string, any>) => void

Dynamically update the styles of a form field. Style API Reference

setError()

(...error: string | {index:number; message: string}) => void

Method used to set the error of a field. The error may be passed as text or as an object.

An error with the shape {message: <fieldErrorString>, index: <fieldIndex>}} will set an error for a specific repeatable field across its repetitions. Setting an error prevents the step from submitting.

equals()

(...values: string | Field) => boolean

Returns true if the field equals any of the values passed. A value may be a string or another Field.

notEquals()

(...values: string | Field) => boolean

Returns true if the field does not equal any of the values passed. A value may be a string or another Field.

greaterThan()

(...values: string | Field) => boolean

Returns true if the field is greater than any of the values passed. A value may be a string or another Field.

greaterThanOrEqual()

(...values: string | Field) => boolean

Returns true if the field is greater than or equal to any of the values passed. A value may be a string or another Field.

lessThan()

(...values: string | Field) => boolean

Returns true if the field is less than any of the values passed. A value may be a string or another Field.

lessThanOrEqual()

(...values: string | Field) => boolean

Returns true if the field is less than or equal to any of the values passed. A value may be a string or another Field.

isFilled()

() => boolean

Returns true if the field contains a value that was set by the user or by logic.

isEmpty()

() => boolean

Returns true if the field does not contains a value, i.e. the field was not set by the user or by logic.

isTrue()

() => boolean

Returns true if the field is true or truthy.

isFalse()

() => boolean

Returns true if the field is true or falsy.

contains()

(...values: string | Field) => boolean

Returns true if the field text contains the text of any of the values passed. The text must match on upper/lower case exactly. A value may be a string or another Field.

doesNotContain()

(...values: string | Field) => boolean

Returns true if the field text does not contain the text of any of the values passed. The text must match on upper/lower case exactly. A value may be a string or another Field.

containsIgnoreCase()

(...values: string | Field) => boolean

Returns true if the field text contains the text of any of the values passed. The text comparison ignores upper/lower case differences and will match on different cases. A value may be a string or another Field.

doesNotContainIgnoreCase()

(...values: string | Field) => boolean

Returns true if the field text does not contain the text of any of the values passed. The text comparison ignores upper/lower case differences and will match on different cases. A value may be a string or another Field.

startsWith()

(...values: string | Field) => boolean

Returns true if the field text starts with the text of any of the values passed. The text must match on upper/lower case exactly. A value may be a string or another Field.

doesNotStartWith()

(...values: string | Field) => boolean

Returns true if the field text does not start with the text of any of the values passed. The text must match on upper/lower case exactly. A value may be a string or another Field.

endsWith()

(...values: string | Field) => boolean

Returns true if the field text ends with the text of any of the values passed. The text must match on upper/lower case exactly. A value may be a string or another Field.

doesNotEndWith()

(...values: string | Field) => boolean

Returns true if the field text does not end with the text of any of the values passed. The text must match on upper/lower case exactly. A value may be a string or another Field.

isNumerical()

() => boolean

Returns true if the field value is a number.

isText()

() => boolean

Returns true if the field value is text and not a number.

selectionsInclude()

(...values: string | Field) => boolean

Used for multi-valued fields. Returns true if any of the field's values exactly equal the text of any of the values passed as parameters. A value may be a string or another Field.

selectionsDoNotInclude()

(...values: string | Field) => boolean

Used for multi-valued fields. Returns true if none of the field's values exactly equal the text of any of the values passed as parameters. A value may be a string or another Field.

Last updated