The following Twig functions are available to call in your Twig templates.
craft.formie.forms(query)
#See Form Queries
craft.formie.submissions(query)
#craft.formie.renderForm(form, options = {})
#Renders the entire form, taking into account custom Form Templates. The form
parameter can be a Form object, or the handle of a form. For details on the options you can pass into the options
parameter, see Render Options.
craft.formie.renderPage(form, page)
#Renders a single page, taking into account custom Form Templates. This will also include captchas (if enabled) and submit button(s).
craft.formie.renderField(form, field)
#Renders a single field, taking into account custom Form Templates.
craft.formie.registerAssets(form, options = {})
#Used to specifically register the CSS and JS for a form. Takes the same arguments as craft.formie.renderForm
. This is particular useful for Cached Forms or Custom Rendering.
craft.formie.renderFormCss(form)
#Allows specific placement of a form's CSS on the page. Takes the same arguments as craft.formie.renderForm
craft.formie.renderFormJs(form)
#Allows specific placement of a form's JS on the page. Takes the same arguments as craft.formie.renderForm
craft.formie.renderCss(inline)
#Renders the Formie base and theme CSS. Useful for SPA or lazy loading, where you load forms on-demand. As such, it should only be included one per page.
craft.formie.renderJs(inline)
#Renders the Formie JavaScript (formie.js
) file. Useful for SPA or lazy loading, where you load forms on-demand. As such, it should only be included one per page.
craft.formie.getFieldOptions(field)
#Returns a field's render options from the main options array.
craft.formie.getLabelPosition(field)
#Returns the label position for a field.
craft.formie.getLabelPosition(field)
#Returns the label position for a field.
craft.formie.getInstructionsPosition(field)
#Returns the instructions position for a field.
craft.formie.getParsedValue(value, submission)
#For parsing a variable-string against a submission. For example, you might have a field with a handle emailAddress
, and you could use the string {emailAddress}
and a supplied submission to swap the template tag with the content from a submission.
craft.formie.setCurrentSubmission(form, submission)
#Sets the current submission for a particular form. This is mostly used for multi-page forms.
craft.formie.populateFormValues(handle, values, force = false)
#Populates the defaultValue
of a field for a form. Note that this should be done before rendering the form. See Populating Forms.