Skip to content
Sign inJoin waitlist

Forms — Marai Neesu HTML

The Marai Neesu HTML template has two forms, and they send to the form service or webhook of your choice: a project inquiry and a newsletter sign-up.

The inquiry is on the Contact page and the sign-up in the newsletter box of the Blog. Each form checks the required fields, shows a spinner while sending, says “Thank you” and clears the fields, keeps what the visitor typed when something fails (“Something went wrong”), and drops spam with a hidden honeypot field.

Out of the box they run in demo mode: nothing is sent, and the fields are logged in the browser console. Pick a destination before you publish.

A static site has no server of its own, so submissions go to a form service or a webhook. All of these have a free tier:

Service What it does formEndpoint
Formspree Emails you each submission https://formspree.io/f/<form id>
Web3Forms Emails you each submission, no account needed https://api.web3forms.com/submit, and your key in formAccessKey
Getform, Basin Inbox, email, integrations The form’s endpoint URL
Zapier, Make, n8n, Pipedream Send submissions anywhere: Google Sheets, Slack, a CRM, your newsletter tool The webhook (“catch hook”) URL
  1. Create a form at the service and copy its endpoint.

  2. Open assets/js/config.js and paste it:

    window.siteConfig = {
    formEndpoint: "https://formspree.io/f/abcdwxyz",
    formAccessKey: "", // Web3Forms only
    };
  3. Serve the folder (npx serve .), submit each form (one inquiry from the Contact page, one sign-up from the Blog) and check that the submissions arrived.

  4. Upload config.js with the site.

Every page loads the same config.js, so one endpoint serves both forms. The sample forms in style-guide.html stay in demo mode whatever you set there (they carry data-form-demo), so they never send anything.

The sign-up sends an e-mail address; it doesn’t add anyone to a mailing list by itself. To collect subscribers in Mailchimp, Brevo, ConvertKit or another newsletter tool, point formEndpoint at an automation (Zapier, Make, n8n): let it add the address to your list when form is newsletter, and e-mail you the inquiry when form is contact. With a service that only e-mails you (Formspree, Web3Forms), you receive each new address and add it yourself.

Newsletter tools usually send a confirmation e-mail first (double opt-in): keep that on, it’s what most countries expect.

Each field by its name, as multipart/form-data.

The inquiry on the Contact page (button “Send message”):

Field Name Required
First Name firstName yes
Last Name lastName yes
Email email yes
Phone Number phone yes
I’m interested in …: Product Design, Web Design, Mobile App Design, User Experience (UX) Design (tick boxes) interests
Project Budget (USD) budget yes
Message message

A visitor can tick several boxes: each ticked box is sent as its own interests value, so the service receives interests once per choice (most list them together).

The newsletter sign-up on the Blog (button “Subscribe”): email (required).

Each form also sends form and subject, so you can tell them apart in your inbox or tool:

Form form subject
Inquiry contact New contact inquiry
Newsletter newsletter New newsletter subscriber

With formAccessKey set, the forms also send it as access_key. The honeypot field is left out. The request asks for a JSON answer (Accept: application/json), so the service answers the page instead of showing its own thank-you page.

The fields are ordinary <input> and <textarea> elements inside the <form data-form> of contact.html and blog.html, each in a <label> with its text (the newsletter’s single field is named by its aria-label). Change a label or a placeholder in place. The interests are the <label>s inside the <fieldset> “I’m interested in …”: each holds a tick box <input type="checkbox" name="interests" value="…"> and its text. They are typed in contact.html, not read from your services, so make them match your own (copy a <label> to add one, and change its value and its text).

  • To make a field required, add required to it; the browser checks it before sending. The form shows no mark on required fields, as in the original design: say so in the label if you like (“Phone Number (optional)” for the others).
  • To make a field optional, remove required (the phone number and the budget are required in the demo).
  • To add a field, copy a <label>…</label> and give its input a new name. The service receives whatever the form contains, so there are no settings to update. Don’t name a field fax: it is the honeypot’s.
  • To remove a field, delete its <label>…</label> (or, for First Name and Last Name, which share a row, the <label> and, if you like, the row around the other one).

A field arrives under its name, so keep the names you already map somewhere. The button’s texts are written in the button: the label twice (the second copy is read by screen readers while the form is sending), “Thank you” and “Something went wrong”. “Thank you” and “Something went wrong” are also in the form’s data-success and data-error, which screen readers announce: change both. The title of each submission is the value of the hidden subject field.

To send visitors to a page of your own after a successful send, add data-redirect="thank-you.html" to the <form>.

  • Submit both forms on the live site with a real address, and reply to the test inquiry.
  • The service must answer with a success status (2xx). If it doesn’t, the visitor sees “Something went wrong” and keeps what they typed. Try it once by pasting a wrong endpoint into config.js on your local copy.
  • The browser console tells you what happened: in demo mode it logs [forms] demo mode — set formEndpoint in assets/js/config.js to send submissions with the fields; after a failure, [forms] could not send the form with the reason.

The honeypot stops the usual bots: every form carries a hidden field named fax that a person never sees; a bot that fills it is shown “Thank you” and nothing is sent. The services above filter spam on their side as well. The endpoint is visible in the page source, which is how these services are designed to work.

Submissions go only where you point them. Most countries expect you to say what happens to the data people send you: the inquiry collects a name, an e-mail address, a phone number and a budget, and the sign-up an e-mail address for your newsletter. Marai Neesu has no consent checkbox and no privacy page: add a page with your privacy notice (Editing the site) and link it under the forms or in the footer.