Forms
Meli allows you to submit HTML forms easily. At the moment, we only support sending form submissions by email. Hence, you will need to configure emails beforehand.
info
Inputs of type file are sent as attachments.
Captcha#
Forms can be protected using Google Recaptcha V3.
- Get your API keys here.
- Configure environment variables in Meli:
Using <script/>#
Place a .meli.yml at your site root:
Create an HTML form:
By default, the sdk automatically looks for forms with the data-form attribute. You can disable this by:
- adding the
data-meli-init="false"to your script tag - removing the
asyncdirective from your script tag
Using Npm#
Install the SDK:
Use it in your code:
Api#
To pass your own forms:
Manually create a form and bind it:
To remove all listeners:
Events#
On the HTML form element:
Or on the Form object:
| Event | Callback signature | Description |
|---|---|---|
submitting | () => void | The form submit callback was called. |
submitted | () => void | The form was submitted successfully. |
error | (error) => void | Something went wrong. |