Embedding

Embed options: JS, iframe, API

3-minute read

Four ways to wire a form to JustForms. Pick whichever fits your stack.

1. JavaScript embed (recommended)

Wraps your existing HTML form with AJAX submission, honeypot, conversion tracking, and redirect handling.

<form data-justforms="FORM_ID"
      data-redirect="/thanks"
      data-success="Thanks! We'll be in touch.">
  <input name="name" required>
  <input name="email" type="email" required>
  <button>Send</button>
</form>
<script src="https://justforms.rightnode.workers.dev/embed.js" defer></script>

Best for

2. Iframe drop-in

Zero setup. Fully styled. Auto-resizing via postMessage.

<iframe src="https://justforms.rightnode.workers.dev/iframe/FORM_ID"
        width="100%" height="600" style="border:0"></iframe>

Best for

3. Direct POST (no JS at all)

Use any HTML form's native submit. Works without JavaScript.

<form action="https://justforms.rightnode.workers.dev/f/FORM_ID" method="POST">
  <input name="name" required>
  <input name="email" type="email" required>
  <button>Send</button>
</form>

On success, browser redirects to your form's configured redirect URL (or shows a JSON response).

Best for

4. Programmatic (SPA / React / Vue)

Use the global JustForms object after the embed script loads:

const r = await JustForms.submit('FORM_ID', {
  name: 'Alex',
  email: 'alex@example.com',
  message: 'Hi'
});
console.log(r);  // { ok: true, id: '...', tracking: {...} }

Or call the endpoint directly:

fetch('https://justforms.rightnode.workers.dev/f/FORM_ID', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: '...', email: '...' })
}).then(r => r.json());

All data-* attributes

data-justformsRequired. Form ID from dashboard.
data-redirectURL to send to on success.
data-successInline success message (if no redirect).
data-errorInline error message.
data-turnstile-keyCloudflare Turnstile site key (auto-renders).