AI fill for Squarespace forms: add a Code Block under your form

Updated 2026-10-30

Your visitors are tired of typing into boxes. Let their AI do it. In Squarespace you add one Code Block below your form and paste one script tag into it. Your form does not change. A button appears above it. It takes about five minutes.

Steps

  1. Find your form's id. Open the published page, right-click the form, and choose Inspect. Look at the line that starts with <form. Copy the value of id.
  2. Edit the page with your form.
  3. Hover over the section below your form. Click Add block, or click the + sign. Click Code.
  4. Click the pencil icon on the block to open its editor.
  5. Set the mode to HTML. Make sure Display Source is switched off.
  6. Paste the snippet below. Change your-form-id to the id from step 1.
  7. Save the page. Open it in a private browser window and look for the button above the form.

The snippet

html
<script src="https://aiformapi.com/agent-fill.js" data-form="#your-form-id"></script>

If your page has only one form, you can leave out data-form. A newsletter form in the footer counts as a second form, so I suggest you set it.

Good to know

  • Squarespace says custom code can break how your site looks or works, especially on phones. Check your page on a phone.
  • If a code block stops you from editing your site, Squarespace says to disable scripts in preview, then edit or remove the code.
  • Squarespace says code may not show on a page when Ajax loading is on. If your button is missing, check that setting.
  • Squarespace support cannot help with custom code.

Check it

Press the button. The prompt must list your field labels. Give it to an AI, paste the answer back, and the boxes fill. Then press your own submit button.

What I checked

I read the Squarespace help page for the steps above. I ran the snippet on a test page with a form and the script after it. I did not run it on a live Squarespace site.

Sources (read 2026-10-30)

Questions

Which Squarespace plan do I need?

Squarespace says that to add JavaScript or an iframe to a code block, your site needs to be on the Core, Plus, or Advanced plan. Check your plan before you start.

Why do I see the code as text instead of a button?

The Display Source switch is on. Open the Code Block, set the mode to HTML, and switch Display Source off. With it on, Squarespace shows your code as text.

Why do I not see the button while I am logged in?

Squarespace says code sometimes does not appear while you are logged in, even when visitors can see it. Open the page in a private browser window to check.