Reference

Submission

A Submission object represents data that has been saved through a form. That can be a completed submission, a partially saved submission, or a submission that has been marked as spam.

Properties

id

The submission ID.

formId

The form ID this submission belongs to.

form

The Form this submission belongs to.

statusId

The submission status ID.

status

The submission status handle.

userId

The user ID associated with the submission, when collected.

user

The Craft user associated with the submission, when collected.

siteId

The site ID this submission was made on.

snapshot

The saved render snapshot used for field settings and submission output.

ipAddress

The submitter IP address, when collected.

isIncomplete

Whether the submission is incomplete.

isSpam

Whether the submission has been marked as spam.

spamReason

The spam reason, when the submission is marked as spam.

validateCurrentPageOnly

Whether validation should only run for the current page.

dateCreated

The date the submission was created.

Methods

getForm()

Returns the submission’s Form.

getPages()

Returns the form pages for this submission.

getRows()

Returns the form rows for this submission.

getFields()

Returns the form fields for this submission.

getFieldByHandle()

Returns a field by handle.

setFieldValue()

Sets a field value on the submission.

getFieldValue()

Returns the field's normalised PHP value for the supplied field key. Text and Email return strings; Name returns NameFieldValue; Phone returns PhoneFieldValue. Dates and selected options return their field value objects, and relation fields return Craft queries. This method takes no output-format argument. Use getFieldValueAsString() for display text or getFieldValueAsData() for JSON-safe data.

getFieldValueAsString()

Returns the field value as a string.

getFieldValueAsData()

Returns a field value that can be encoded as JSON. Simple fields return a single value, such as a string or boolean; fields such as Address return named parts.

getFieldValueForReference()

Returns the field value prepared for singular reference contexts.

getFieldValueForReferenceBlock()

Returns the field value prepared for reference-block rendering.

getFieldValueForExport()

Returns the field value prepared for export.

getFieldValueForReport()

Returns the field's readable report-cell value. For example, submission.getFieldValueForReport('name') returns a combined name, while submission.getFieldValueForReport('name.firstName') returns its first name. Pass false as the second argument to use stored option values instead of labels. This method is used by report tables and report exports; getFieldValueForExport() retains structured field export data.

getFieldValueForSummary()

Returns the field value prepared for summary views.

getFieldValueForIntegration()

Returns the field value prepared for an integration field.

getValuesAsString()

Returns all submitted field values as strings.

getValuesAsData()

Returns a handle-keyed map of JSON-safe field data. Individual values may be scalars, null or structured arrays.

getValuesForExport()

Returns all submitted field values prepared for export.

getValuesForSummary()

Returns all submitted field values prepared for summary views.

getRelations()

Returns element relations found in the submission.

getPayments()

Returns payment records associated with the submission.

getSubscriptions()

Returns subscription records associated with the submission.