Detected form widget with an existing Netlify form

Layering a detected form widget on a Netlify-handled HTML form: keep data-netlify and form-name intact, add consent and honeypot checks, then verify…

James HollowayWeb Development Lead6 min read

If your HTML form already submits through Netlify, you do not need to rebuild it to add a consent checkbox, a spam trap and a clearer confirmation step. A detected form widget with an existing Netlify form attaches to the form you already render: Netlify keeps receiving the submissions it receives today, and the widget adds required consent, client-side spam checks and confirmation behaviour around it. The one rule is that the attributes Netlify relies on — data-netlify and the hidden form-name field — must survive the embed untouched. This guide covers what the widget changes, what it must never change, and a repeatable test run before launch.

If you want the underlying mechanics of attaching the widget to an in-page form, the consent checkbox guide for existing forms explains how detection works without a rebuild.

What the detected form widget adds — and what it leaves untouched

The detected form widget connects an existing HTML form to WidgetJar. It does not replace the form or move its handler. For a Netlify setup that means:

  • Untouched: the form action, method and name, the hidden form-name input, and the data-netlify attribute.
  • Added: typically a required consent checkbox, a honeypot field and timing check, and a confirmation message or redirect configured in the panel.

Treat that split as a contract. Netlify's build-time detection and its submission handler depend on the markup staying recognisable; anything that strips the marker or renames the hidden field silently disconnects the form from its submissions.

Why the Netlify attributes must stay exactly as they are

Netlify finds forms by looking for a marker on the <form> element plus a hidden field that names the form being posted. A typical page looks like this:

<form name="contact" method="POST" data-netlify="true" action="/thank-you">
  <input type="hidden" name="form-name" value="contact" />
  <label for="email">Email</label>
  <input id="email" name="email" type="email" required />
  <button type="submit">Send</button>
</form>

The action and method are functional, not decorative. As MDN explains in Sending and retrieving form data, action defines where the data is sent and method defines how — the browser builds an HTTP request from those attributes and the named controls. Change either and you change where submissions land.

Pre-install audit: record the before state

You cannot prove nothing changed unless you wrote down what the form does today. Do this first, in the editor and in the browser:

  1. Record the form's action, method, name and whether data-netlify is present.
  2. Record the exact value of the hidden form-name field.
  3. List every visible field name and type, plus any other hidden inputs.
  4. Submit one real test entry and confirm it appears in your Netlify dashboard.
  5. Copy the URL of the success page or confirmation a visitor sees.

Keep the list beside you for the rest of the setup. The honeypot spam protection guide runs a similar before/after audit for hidden fields and timing checks, and is worth reading if you plan to rely on both layers.

Configure the widget for a form Netlify already processes

In the WidgetJar panel, register the domain that hosts the site, create a detected form widget and point it at the form your page already renders. Install the WidgetJar embed script on the page that contains the Netlify form, then save.

Add a required consent checkbox in the widget with wording that matches what you actually collect. Because the checkbox is required, the browser blocks submission until it is ticked — the native mechanism MDN describes in Client-side form validation: an empty required control is invalid, and an attempted submission focuses the field and shows a message. No custom JavaScript is needed for that loop, and you should avoid adding your own script that duplicates it.

After saving, re-check the page source. data-netlify and form-name must still be present, and the consent checkbox should appear exactly once.

Spam protection that coexists with Netlify's own filtering

Netlify screens submissions on its side. The widget's checks sit in the browser, before the request:

  • Honeypot field: a field real visitors never fill but simple bots often do, hidden in a way that does not trap keyboard or screen reader users.
  • Timing check: flags submissions that arrive implausibly fast after the form is loaded.

Keep both subtle. Don't stack multiple honeypots, and don't add a second timing check of your own on top of the widget's — duplicate checks are a common cause of the consent loop described below.

Confirmation behaviour: in-page message or redirect

Netlify forms typically send visitors to a success page defined by action. The widget can instead show an in-page confirmation or perform a configured redirect. Pick one owner of the final step so visitors don't bounce twice.

If you keep Netlify's redirect, leave action pointed at the success page and make sure the widget does not pre-empt it. If you want an in-page message, you are changing what the visitor sees after submit — confirm the submission still reaches Netlify. The redirect after submission guide compares both patterns and links them to page goals.

Confirm where submissions actually go

Run a real submission before and after the embed and watch the request in your browser's developer tools. Open the Network panel, submit the form, and inspect the request URL and payload. The payload should contain form-name plus your field values. MDN notes that with POST the data sits in the request body while GET appends it to the URL; if your payload is empty or the URL suddenly carries field values, an attribute changed.

Test script: verify the whole path

Run this after every configuration change:

  • Page source still contains data-netlify and the hidden form-name field.
  • Submit a real entry and confirm it appears in the Netlify dashboard.
  • Confirm the consent value is recorded with the submission.
  • Submit without ticking consent; the browser blocks and focuses the checkbox.
  • Complete the form with keyboard only, including the checkbox via Space.
  • Confirm the final confirmation or redirect you configured actually appears.
  • Check that labels and error wording read clearly — the HTML form labels guide has a short audit for this.

Common failure modes

  • Form no longer detected by Netlify: data-netlify or the hidden form-name field was removed or renamed during a template edit.
  • Duplicate fields: the widget inserted a consent field while the template already had one; remove one.
  • Consent checkbox loop: a second script competes with the required state; keep validation native.
  • Redirect losing the submission: the redirect fires before the request completes; confirm the POST returned successfully in the Network panel.

Next step

Once your audit list matches the after state and every test line passes, you can leave both layers in place. Create or adjust the widget in the detected form widget panel, install the embed script on the domain hosting your Netlify form, and run the test script once more on mobile before launch.

WidgetJar is an embeddable widget platform: you create and configure widgets in the panel, then install the embed script on your registered domain. Keep server-side validation on your receiving side regardless — MDN stresses that client-side validation is easy to bypass and should never be your only check.

  • detected form widget with an existing Netlify form
  • forms
  • netlify
  • consent
  • spam protection

Written by

James Holloway

Web Development Lead at WidgetJar

Keep reading

Get started

Your next lead is one line away.

Pick a design, make it yours and paste a single script tag. Every widget type is included, and you do not need a credit card to start.

<script src="https://cdn.widgetjar.com/wj-assets/embed.js" defer></script>