You are viewing beta documentation for Formie 4.x.
Reference

Field

A Field object represents one field instance on a form. This is different from the general idea of a field type; here, you are working with the actual field that is being rendered, inspected or processed.

Properties

id

Type: string|int|null

The form-field instance ID. Submission and client field identity use this instance, not its shared definition.

uid

Type: string|null

The form-field instance UID. Copies and new imports receive new instance UIDs.

definitionId

Type: int|null

The shared definition's database ID. Synced fields share this value. It is not a submission content key.

definitionUid

Type: string|null

The shared definition's portable UID, used when a stencil explicitly preserves a Synced Field relationship.

label

Type: string|null

The field label.

handle

Type: string|null

The field handle.

reference

Type: string|null

The stable field reference, when available.

type

Type: string

The field type.

form

Type: verbb\formie\elements\Form|null

The Form this field belongs to.

required

Type: bool

Whether the field is required.

enabled

Type: bool

Whether the field is enabled.

instructions

Type: verbb\formie\models\RichText

The field instructions.

placeholder

Type: string|null

The field placeholder, where supported.

defaultValue

Type: mixed

The field default value, where supported.

settings

Type: array

The field settings.

Methods

The methods below help you render fields and read their values. For implementing storage and value handling in your own field type, see Custom Field.

hasLabel()

Returns: bool

Returns whether the field should render a label.

getHtmlId()

Returns: string

Returns the field’s HTML id value.

getHtmlName()

Returns: string

Returns the field’s HTML name value.

getContainerAttributes()

Returns: array

Returns attributes for the field container.

getInputAttributes()

Returns: array

Returns attributes for the field input, where applicable.

getFrontEndInputHtml()

Returns the field’s front-end input HTML.

getReferenceBlockHtml()

Returns: string|bool|null

Returns the field’s reference-block HTML.

getParentField()

Returns: verbb\formie\base\FieldInterface|null

Returns the parent field for sub-fields and nested fields.

setParentField()

Sets the parent field for sub-fields and nested fields.

getValueAsString()

Returns: mixed

Returns a string representation of a submitted value.

getValueAsData()

Returns: mixed

Returns natural JSON-safe data: scalars for primitive fields, named parts or selected records for rich fields.

getValueForExport()

Returns: mixed

Returns the value prepared for export.

getValueForSummary()

Returns: mixed

Returns the value prepared for summary views.

getValueForReference()

Returns: mixed

Returns the value prepared for singular reference contexts.

getValueForReferenceBlock()

Returns: mixed

Returns the value prepared for reference-block rendering.

Last updated: Sept 30, 2026, 10:01:22 PM