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

Form

A Form object represents the whole form: its settings, pages, fields, notifications and render context. When you work with a form in Twig or PHP, this is usually the main object you are dealing with.

Properties

id

Type: int|null

The form ID.

title

Type: string|null

The form title.

handle

Type: string|null

The form handle.

configJson

Encoded JSON used by Formie’s front-end form handling.

defaultStatus

Type: verbb\formie\models\SubmissionStatus|null

The default status for new submissions on this form.

template

Type: verbb\formie\models\FormTemplate|null

The form template assigned to the form, if one is set.

groupId

Type: int|null

The ID of the form group this form belongs to in the control panel, if any.

Methods

getPages()

Returns: array

Returns the form’s Page objects.

hasMultiplePages()

Returns: bool

Returns whether the form has more than one page.

getCurrentPage()

Returns: verbb\formie\models\FieldLayoutPage|null

Returns the current page for multi-page form handling.

getPreviousPage()

Returns: verbb\formie\models\FieldLayoutPage|null

Returns the previous page, if one exists.

getNextPage()

Returns: verbb\formie\models\FieldLayoutPage|null

Returns the next page, if one exists.

getCurrentPageIndex()

Returns: int

Returns the current page’s zero-based index.

isFirstPage()

Returns: bool

Returns whether the current page is the first page.

isLastPage()

Returns: bool

Returns whether the current page is the last page.

getFields()

Returns: array

Returns all Field objects on the form.

getFieldByHandle()

Returns: verbb\formie\base\FieldInterface|null

Returns a field by its handle.

getNotifications()

Returns: array|null

Returns all Notification objects attached to the form.

getEnabledNotifications()

Returns: array

Returns the enabled notifications attached to the form.

getRedirectUrl()

Returns: string

Returns the URL Formie will redirect to after a successful submission, when applicable.

getCurrentSubmission()

Returns: verbb\formie\elements\Submission|null

Returns the submission currently associated with the form render, when available.