Form#

A Form object is the collection of fields, pages, rows and settings for a form. Whenever you're dealing with a form in your template, you're actually working with a Form object.

Attributes#

AttributeDescription
idID of the form.
titleThe title of the form.
handleThe handle of the form.
fieldContentTableThe name of the content table that stores the content for this form's submissions.
templateReturns the Form Template, if provided.
templateIdThe Form Template ID for this form, if applicable.
submitActionEntryIdIf chosen to have a entry be the redirect action for a form, this will be the Entry (opens new window) ID.
defaultStatusThe default status for the submission made on this form.
defaultStatusIdThe default status ID for the submission made on this form.
formIdThis will output the ID for a form, in the format formie-form-{id}. This is required for JavaScript-enabled forms.
configJsonThis will output encoded JSON to be output in the <form> element. This is required for JavaScript-enabled forms.

Methods#

MethodDescription
getFormFieldLayout()Returns the field layout for this form.
getFormFieldContext()Returns the field context fields in this form use when being saved.
getCpEditUrl()Returns the URL to the control panel to edit a form.
getFormConfig()Returns configuration for a form, used in the form builder.
getPages()Returns an array of Page objects for the form.
hasMultiplePages()Whether the form has more than 1 page.
getCurrentPage()For multi-page forms, returns the current page the user is submitting on.
getPreviousPage()For multi-page forms, returns the previous page, if applicable.
getNextPage()For multi-page forms, returns the next page, if applicable.
getCurrentPageIndex()For multi-page forms, returns the current page's index. Useful for progress bars.
setCurrentPage()For multi-page forms, this sets the current page to the provided page.
resetCurrentPage()For multi-page forms, this resets the current page. Usually used when the form is completed.
isLastPage()For multi-page forms, whether the current page is the last page.
isFirstPage()For multi-page forms, whether the current page is the first page.
getCurrentSubmission()Returns the current submission, particularly useful for multi-page forms.
resetCurrentSubmission()Resets the current submission. Usually used when the form is completed.
getFields()Returns all Field objects for this form.
getFieldByHandle()Returns the Field object for a provided handle.
getNotifications()Returns all Notification objects for this form.
getEnabledNotifications()Returns all enabled Notification objects for this form.
getRedirectUrl()Returns the URL for the redirection upon final submission of the form.
getRedirectEntry()Returns the Entry (opens new window) used for redirection, if applicable.

Form Settings#

Each form has a collection of settings associated with it.

Attributes#

AttributeDescription
displayFormTitleWhether to show the form’s title.
displayPageTabsWhether to show the form’s page tabs.
displayCurrentPageTitleWhether to show the form’s current page title.
displayPageProgressWhether to show the form’s page progress.
submitMethodThe form’s submit method. ajax or page-reload.
submitActionSet the submission action. message, entry, url, reload.
submitActionTabWhether to the redirect URL should open in a new tab.
submitActionUrlThe URL to redirect to on success.
submitActionFormHideWhether the form should be hidden on success.
submitActionMessageThe success message as HTML shown on validation success.
submitActionMessageTimeoutWhether the success message should hide after the provided number of milliseconds.
errorMessageThe error message as HTML shown on validation failure.
loadingIndicatorThe type of loading indicator to use. none, spinner or text.
loadingIndicatorTextThe text for the loading indicator.
validationOnSubmitWhether to validate the form fields on-submit.
validationOnFocusWhether to validate the form fields on-focus.
submissionTitleFormatThe submission title format.
collectIpWhether to collect the IP address of the user.
collectUserWhether to collect a logged-in user against the form.

Previous ← Hooks Next Page →