# Forms

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

{% hint style="info" %}
The POST will return an object, for example,`{"id_lead":"1078699","success":true}`

Check that`success` is true
{% endhint %}

## 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:&#x20;

```markup
<!-- 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&#x20;

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

## Email notification

&#x20;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:&#x20;

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

&#x20;CMS Builder variable options&#x20;

```
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:

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

CMS Builder variable options&#x20;

![](https://3028197268-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LYM6a76uZePOTen0dIw%2F-MgBTklJpYCz2GRmLrTY%2F-MgBUg1nepzJw6IbLqdF%2FCapture%20d%E2%80%99e%CC%81cran%202021-08-02%20a%CC%80%2016.15.47.png?alt=media\&token=1021756e-a361-404b-9b17-2189142f48af)

## Fields names

Default names to follow:&#x20;

```
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:

```markup
<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

{% hint style="danger" %}
For GDPR compliances, the labels of the inputs needs to be there. This allows to know "to which label did the user put which content"
{% endhint %}
