Forms

As we are building static html files, forms must be submitted in AJAX.

POST the form to window._dynamic_base + '/lead/' + window.websiteID.Then the data will be available in the "Lead" section of the backoffice.

The POST will return an object, for example,{"id_lead":"1078699","success":true}

Check thatsuccess is true

Form name

Form name In the backoffice, you can see a column "form" to each lead. By default the value will be "default". This can be changed on each form by adding a key to the form. You need to add a hidden field with name="form" and value="key" For instance:

<!-- Here the form will be tagged as a "contact" form  -->
<input type="hidden" name="form" value="contact">

Most of the time, if the form is specific only for one page and is not in a bloc available in the composer, it's easier to let the developper choose the name of the form (client can forget to fill the field in the BO). We choose a name depending of the page example "wedding-form" etc... When the block is used in several pages, you can also let the user choose the key of the form with a variable.

CMS Builder variable options

label = "Form name in backoffice" 
is_translate = "0

Email notification

The lead will be added in the "Lead" section of the website but won't be sent by email. To change this you can add to the form:

<input type="hidden" name="form_recipients[]" value="#$variable|crypt()-form-recipients$#">

CMS Builder variable options

label = "Email notification - Form recipients (email separated by commas)" 
is_translate = "0"

We use the crypt function that will encrypt the email in the frontend so it's no readable.

Email notification - Custom template

There is a tab in the Leads section called "Customize Email Notifications" (Website > Leads > Customize Email Notifications). For now, we've added the possibility to add a custom Email subject to the form submission emails. In the future we plan on adding more customizations to this screen.

To allow user to apply one of added customisation to a form, you'll have to add the following code to it:

{if=" '#$variable|form-notification$#' "}
    <input type="hidden" name="lead_personnalise" value="#$variable|form-notification$#">
{/if}

CMS Builder variable options

Fields names

Default names to follow:

name="firstname" 
name="lastname" 
name="email" 
name="comment"

With the pattern name="label_NAMEHERE" , you define the label of the fields. For example we have:

<input type="hidden" name="label_lastname" value="__@@Last Name@@__">
<label for="field_last-name" class="form-label">__@@Last Name@@__</label>
<input type="text" id="field_last-name" name="lastname" class="form-input" placeholder="__@@Last Name@@__">
  • The first input defines the label. It is hidden to the user. The name is label_ + the name of the input linked

  • Then we have the label

  • Lastly, the input where the user enters the content

Last updated