Zunoy header logo
Products
Resources
HTML Integration

HTML Contact Form with only Frontend Code

Start collecting form submissions from your HTML form with FormSubmit in 2 minutes. Create your form in FormSubmit and paste your unique URL inside your form. Check out the code examples and detailed tutorial below to get started.

Vs Code

  import { useState } from "react";

  export default function Fetch() {
    const [email, setEmail] = useState("");
    const [message, setMessage] = useState("");

    const [submitted, setSubmitted] = useState(false);
    const [error, setError] = useState("");

    function submit(e) {
      e.preventDefault();

      fetch("https://formAPI.com/s/XXXXXXX", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Accept: "application/json",
        },
        body: JSON.stringify({ email, message }),
      })
        .then((res) => res.json())
        .then((res) => {
          if (res.code === 200) {
            setSubmitted(true);
          } else {
            setError(res.message);
          }
        })
        .catch((error) => setError(error));
    }

    return (
      <form onSubmit={submit}>
        {/* Form implementation */}
      </form>
    );
  }
  

How to Integrate Code

What is HTML?

HTML (HyperText Markup Language) is the standard language for creating web pages. With FormSubmit, you can easily collect form submissions from your HTML forms without needing a backend.

FormSubmit Setup with HTML using Fetch

Fetch is a built-in JavaScript API that allows you to send form data easily. Below is an example demonstrating how to send form submissions from an HTML form to FormSubmit using Fetch. Ensure that you replace “https://formAPI.com/s/XXXXXXX” with your unique endpoint URL.

Vs Code

  import { useState } from "react";

  export default function Fetch() {
    const [email, setEmail] = useState("");
    const [message, setMessage] = useState("");

    const [submitted, setSubmitted] = useState(false);
    const [error, setError] = useState("");

    function submit(e) {
      e.preventDefault();

      fetch("https://formAPI.com/s/XXXXXXX", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Accept: "application/json",
        },
        body: JSON.stringify({ email, message }),
      })
        .then((res) => res.json())
        .then((res) => {
          if (res.code === 200) {
            setSubmitted(true);
          } else {
            setError(res.message);
          }
        })
        .catch((error) => setError(error));
    }

    return (
      <form onSubmit={submit}>
        {/* Form implementation */}
      </form>
    );
  }
  

FormSubmit Setup with HTML using Fetch

Fetch is a built-in JavaScript API that allows you to send form data easily. Below is an example demonstrating how to send form submissions from an HTML form to FormSubmit using Fetch. Ensure that you replace “https://formAPI.com/s/XXXXXXX” with your unique endpoint URL.

Vs Code

  import { useState } from "react";

  export default function Fetch() {
    const [email, setEmail] = useState("");
    const [message, setMessage] = useState("");

    const [submitted, setSubmitted] = useState(false);
    const [error, setError] = useState("");

    function submit(e) {
      e.preventDefault();

      fetch("https://formAPI.com/s/XXXXXXX", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Accept: "application/json",
        },
        body: JSON.stringify({ email, message }),
      })
        .then((res) => res.json())
        .then((res) => {
          if (res.code === 200) {
            setSubmitted(true);
          } else {
            setError(res.message);
          }
        })
        .catch((error) => setError(error));
    }

    return (
      <form onSubmit={submit}>
        {/* Form implementation */}
      </form>
    );
  }
  

FormSubmit Setup with HTML using Fetch

Fetch is a built-in JavaScript API that allows you to send form data easily. Below is an example demonstrating how to send form submissions from an HTML form to FormSubmit using Fetch. Ensure that you replace “https://formAPI.com/s/XXXXXXX” with your unique endpoint URL.

Vs Code

  import { useState } from "react";

  export default function Fetch() {
    const [email, setEmail] = useState("");
    const [message, setMessage] = useState("");

    const [submitted, setSubmitted] = useState(false);
    const [error, setError] = useState("");

    function submit(e) {
      e.preventDefault();

      fetch("https://formAPI.com/s/XXXXXXX", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          Accept: "application/json",
        },
        body: JSON.stringify({ email, message }),
      })
        .then((res) => res.json())
        .then((res) => {
          if (res.code === 200) {
            setSubmitted(true);
          } else {
            setError(res.message);
          }
        })
        .catch((error) => setError(error));
    }

    return (
      <form onSubmit={submit}>
        {/* Form implementation */}
      </form>
    );
  }
  

Set Up Forms Checks in 60 Seconds

Choose HTTPS Monitor

Select HTTPS monitoring to track website uptime, SSL expiry, redirects, and response codes from global locations.

Enter Site URL & Options

Type your website URL, add optional headers or auth tokens, then pick the check interval you prefer.

Activate & Get Instant Status

We run the first check instantly and alert on downtime, SSL errors, or failed HTTPS responses.

USe CAses

Need templates? Say less.

A collection of example HTML forms with code that you can edit live, then download or copy/paste. A minimal form reset css is included that should work with most sites. A minimal form reset css is included that should work with most sites. A minimal form reset css is included that should work with most sites.

  • Simple Contact Form
  • Survery Form
  • Book a Demo Form
  • News Letter Form
  • Registration Form & more...
Learn More
timeLine

Ready to Experience Zunoy?

Start your journey with Zunoy’s powerful suite of tools, designed for startups, developers, and growing teams alike.

All our products come with a lifetime free tier.

perisync

FormAPI

Collect submissions without a backend—add a headless endpoint to any <form>

Operational

Available On

forms
forms

Contact Us On

Connect

Facebook Icon
Instagram
Twitter
LinkedinIcon

Copyright © 2025 - Mentcube Innovations Pvt Ltd. All Rights Reserved.

FormAPI