NPS survey
Net Promoter Score survey with a 0-10 rating.
Fields
EmailemailHow likely are you to recommend us? (0-10)numberrequiredWhat is the main reason for your score?textarea
Preview
Code
<script setup lang="ts">
import { ref } from "vue";
const sent = ref(false);
async function onSubmit(e: Event) {
const form = e.target as HTMLFormElement;
const res = await fetch("https://formward.eu/f/your-form-id", {
method: "POST",
headers: { Accept: "application/json" },
body: new FormData(form),
});
if (res.ok) {
sent.value = true;
form.reset();
}
}
</script>
<template>
<p v-if="sent">Thanks! Your message has been sent.</p>
<form v-else @submit.prevent="onSubmit">
<label for="email">Email</label>
<input type="email" name="email" id="email" />
<label for="score">How likely are you to recommend us? (0-10)</label>
<input type="number" name="score" id="score" required />
<label for="reason">What is the main reason for your score?</label>
<textarea name="reason" id="reason"></textarea>
<input type="text" name="_gotcha" tabindex="-1" autocomplete="off" style="position:absolute;left:-9999px" aria-hidden="true" />
<button type="submit">Send</button>
</form>
</template>
Use this with Formward
Create a form, copy your endpoint, and replace https://formward.eu/f/your-form-id in the code above.