Customer satisfaction survey
Measure customer satisfaction (CSAT).
Fields
NametextEmailemailHow satisfied are you?selectCommentstextarea
Code
import { useState } from "react";
export function CustomerSatisfactionSurveyForm() {
const [sent, setSent] = useState(false);
async function onSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault();
const form = e.currentTarget;
const res = await fetch("https://formward.eu/f/your-form-id", {
method: "POST",
headers: { Accept: "application/json" },
body: new FormData(form),
});
if (res.ok) {
setSent(true);
form.reset();
}
}
if (sent) return <p>Thanks! Your message has been sent.</p>;
return (
<form onSubmit={onSubmit}>
<label htmlFor="name">Name</label>
<input type="text" name="name" id="name" />
<label htmlFor="email">Email</label>
<input type="email" name="email" id="email" />
<label htmlFor="satisfaction">How satisfied are you?</label>
<select name="satisfaction" id="satisfaction">
<option value="Very satisfied">Very satisfied</option>
<option value="Satisfied">Satisfied</option>
<option value="Neutral">Neutral</option>
<option value="Dissatisfied">Dissatisfied</option>
<option value="Very dissatisfied">Very dissatisfied</option>
</select>
<label htmlFor="comments">Comments</label>
<textarea name="comments" id="comments" />
<input
type="text"
name="_gotcha"
tabIndex={-1}
autoComplete="off"
style={{ position: "absolute", left: "-9999px" }}
aria-hidden="true"
/>
<button type="submit">Send</button>
</form>
);
}
Use this with Formward
Create a form, copy your endpoint, and replace https://formward.eu/f/your-form-id in the code above.