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.
#
CaptchaForms can be protected using Google Recaptcha V3.
- Get your API keys here.
- Configure environment variables in Meli:
<script/>
#
Using 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
async
directive from your script tag
#
Using NpmInstall the SDK:
Use it in your code:
#
ApiTo pass your own forms:
Manually create a form and bind it:
To remove all listeners:
#
EventsOn 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. |