Link Search Menu Expand Document

Enquiry form

The enquiry_form tag renders a form which represents an Enquiry form that the Creator has constructed in the Admin. Each input and label can be generated with Input and label tags. It requires an enquiry form parameter to be passed. In the below example that is swim_enquiry_form.


Attributes

form.id

string

The unique ID for the form.

form.fields

array of Fields

An array of all the form’s Fields


Example

input
  {% form "enquiry_form", swim_enquiry_form %}
    {% for field in form.fields %}
      {% label field %}
      {% input field %}
    {% endfor %}
    <input type="submit" value="Send" />
  {% endform %}
output
<form data-controller="form" data-action="submit->form#submit" data-form-action="enquiry_form" action="/sites/enquiries" accept-charset="UTF-8" method="post">
  <label for="enquiry_custom_field_values_attributes_0_entry_attributes_value">Can you swim?</label>
  <input type="hidden" name="enquiry[custom_field_values_attributes][0][custom_field_id]" value="3082fdff-c938...">
  <input type="hidden" name="enquiry[custom_field_values_attributes][0][entry_type]" value="CustomField::Value::Boolean">
  <input type="text" name="enquiry[custom_field_values_attributes][0][entry_attributes][value]" id="enquirycustom_field_values_attributes_0_entry_attributes_value">

  <label for="enquiry_custom_field_values_attributes_1_entry_attributes_value">Special requests</label>
  <input type="hidden" name="enquiry[custom_field_values_attributes][1][custom_field_id]" value="fc3ab6b1-083b...">
  <input type="hidden" name="enquiry[custom_field_values_attributes][1][entry_type]" value="CustomField::Value::Boolean">
  <input type="text" name="enquiry[custom_field_values_attributes][1][entry_attributes][value]" id="enquiry_custom_field_values_attributes_1_entry_attributes_value">

  <input type="hidden" name="enquiry[enquiry_form_id]" value="81fb7e7b-88fa...">
  <input type="submit" value="Send">
</form>

Additional parameters

return_to

The enquiry_form tag will reload the customer’s current page by default on form submit. To direct a customer to a different page you can pass a URL as the value of the return_to: param.

The following example would redirect to the homepage:

input
{% form "enquiry_form", swim_enquiry_form, return_to: '/' %}
  ...
{% endform %}

Table of contents