Skip to content
Documentation

Connect Vue forms to email

Receive messages from a Vue contact component with a native form submission. The input names become fields in GlueForms, so this example needs no reactive state or submit handler.

Connect the form

  1. In GlueForms, open Forms, choose your form and copy its receiving URL. Select it above, or replace YOUR_FORM_URL in the example.

  2. Create src/components/ContactForm.vue with the template below.

HTML
<template>
  <form action="YOUR_FORM_URL" method="POST">
    <label>
      Name
      <input name="name" autocomplete="name">
    </label>
    <label>
      Email
      <input name="email" type="email" autocomplete="email" required>
    </label>
    <label>
      Message
      <textarea name="message" rows="4" required></textarea>
    </label>
    <button type="submit">Send message</button>
  </form>
</template>

  1. Import the component into the page where you want the form. In a Vue/Vite project, this src/App.vue example renders it.
HTML
<script setup>
import ContactForm from './components/ContactForm.vue';
</script>

<template>
  <ContactForm />
</template>

Keep the native action and method attributes. Adding @submit.prevent without an alternative submission handler stops this form from sending.

A native submission opens the GlueForms JSON receipt in the browser. Use JavaScript to show a confirmation on your own page.

Publish the page and submit a message. Open it in GlueForms to check the field names, saved content and email notification.

Official documentation: Vue Single-File Components, Vue event modifiers.