Save a site's form entries in a Horizon Form

Build a site with the Web Builder whose form saves what visitors enter as submissions of one of your Horizon Forms, then read each entry on the form's Submissions page.

A site you build with the Web Builder can have its own form — an enquiry form, a sign-up, a short questionnaire — that saves each entry as a submission of one of your Horizon Forms. Visitors don’t sign in. Every entry appears on the form’s Submissions page, next to entries sent from the form’s own hosted page, and the form’s submission skill (if it has one) runs on it the same way.

You don’t write the code. You pick the form when you open the Web Builder, and it builds a form with one input per question and the code that sends it.

Before you start

  • A published Horizon Form with one question screen. Text, email, number and choice questions all work. A form with more than one screen can’t take entries from a site; see Limits.
  • The Web Builder in your workspace. It opens from Marketing › Sites (see Build a site). If Build a site with an agent shows a message instead of opening, follow what the message says; some of those steps need an admin or Horizon support.
  • Someone who can read the answers. Organization owners and admins can. Anyone else needs Can read form answers: an admin turns it on under System › Settings › Users, with Form Answers on that person’s row. See Users.

1. Create and publish the form

Skip this if you already have a published one-screen form.

  1. Go to Workspace › Forms & Documents › Forms and click Create Form. Enter a Name (and a Description if you like), then click Create. The form builder opens.
  2. Click + Add Screen, then Question Screen. Type a Screen Title and click Save Screen Info. The title has its own Save; the questions you add next save as you go.
  3. Click + Add Question and choose a type: text for a name, email for an email address, radio or select for a choice. Fill in Label. The Field Key fills itself in from the label. Tick Required for questions every visitor must answer.
  4. For a choice question, click + Add Option once per choice. In each row, the first box is the label visitors see and the second is the Value that is saved.
  5. Open the Settings tab on the right and click Publish. Publish becomes Unpublish, and Share shows the form’s Public Form URL.
Settle field keys and option values first

The site sends each answer under its question’s Field Key, and a choice as its option’s Value. Settle those before you build the site. If you change them later, open the site, pick the form again and ask the Web Builder to update the form.

2. Build the site with the form picked

  1. Go to Marketing › Sites.

  2. In the Form list next to Build a site with an agent, choose your form. Only published forms are listed.

  3. Click Build a site with an agent. The Operator panel opens with Web Builder selected.

  4. In Ask a question…, describe the site and say that its form should save into the Horizon form you picked. For example:

    Build a one-page site named solar-enquiries for a small solar installer. Add an enquiry form that saves each visitor’s answers into the Horizon form I picked, with its name, email and “What are you interested in?” choices, and show a thank-you message once it is sent.

  5. Press Enter and wait for the reply; in our test it took about a minute and a half. The Web Builder builds a form with one input per question, with each choice question offering the options you set, and a thank-you message that appears only once Horizon has accepted the entry. It saves the site as an unpublished draft and says so.

To add a form to a site you already have, open the site from Marketing › Sites, choose the form in its Form list, click Edit with agent, and ask for the form.

3. Publish the site

  1. In Marketing › Sites, click the site’s name.
  2. Under Publishing, click Preview draft if you want to see it first, then click Publish version 1 (the button names the draft’s version).
  3. The site shows Live, and Publishing reads “Version 1 is live and there are no unpublished changes.” The site’s address is in the Address column on Sites, and View live version opens it.

Check that it worked

  1. Open the live site in a private browser window, so you aren’t signed in. Fill in the form and send it. The thank-you message replaces the form.
  2. Go to Workspace › Forms & Documents › Forms. The form’s Submissions count has gone up by one.
  3. Open the form’s Submissions page. There is no button for it in the Forms list yet: click the form’s name to open the builder, then in your browser’s address bar replace /builder at the end of the address with /submissions.
  4. The newest entry is at the top, with status Completed and the page it came from under Source URL. Click the row. Submission Data lists each answer under its field key, and a choice shows the option’s Value (for example battery), not its label.

If the form has a submission skill, a new entry shows Processing while its agent runs and Processed when the agent has finished.

Limits

  • One question screen only. A form with more than one screen, a skill screen, or routing that leads to another screen can’t take entries from a site. If you pick one, the Web Builder tells you, builds the site without a form, and saves it as a draft. Make a one-screen version of the form, or link from the site to the form’s Public Form URL so visitors fill it in on Horizon’s hosted page.
  • No uploads. File, image and signature questions can’t be sent from a site. If one is required, the Web Builder won’t add the form.
  • The embed snippet doesn’t work on a Site. The iframe Snippet under the form’s Settings › Embed is for other websites; a Horizon Site won’t display it. Use the form the Web Builder builds, or link to the Public Form URL.
  • About 60 entries per visitor every 10 minutes. Entries are counted per network address. Past that, the site gets a “too many requests” answer, and the form should ask the visitor to try again later (the one the Web Builder built in our test did).
  • Anyone who can open the site can send an entry. Visitors don’t sign in. The form includes a hidden field that filters out simple spam bots; keep it if you edit the site’s code.

Sending entries from your own code

The Web Builder writes this for you, but if you edit the site’s code yourself, a form sends one entry like this:

js
const response = await fetch(
  'https://api.horizonplatform.ai/api/v2/public/forms/YOUR_FORM_ID/submissions',
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      answers: {
        name: 'Dana Walker',
        email: '[email protected]',
        what_are_you_interested_in: 'battery',
      },
      sourceUrl: window.location.href,
      hzn_website: '', // the hidden anti-spam field: always send it empty
    }),
  },
);
const result = await response.json().catch(() => null);
const saved = response.status === 201 && result?.data?.status;
  • YOUR_FORM_ID is the last part of the form’s Public Form URL (Settings › Share).
  • answers holds one entry per question, keyed by its Field Key. A choice is its option’s Value; a multiple-choice question takes a list of values.
  • Treat the entry as saved only when the answer is 201 and data.status is set. Anything else did not arrive.
  • No sign-in or key is needed, and the request can come from any website.
AnswerWhat it means
201 with data.statusSaved. data.status is hf_completed, or hf_processing when the form has a submission skill.
400An answer is missing or invalid, or a key isn’t one of the form’s field keys. error.details names each one.
404No published form has that id. It may be unpublished or deleted.
422The form has more than one screen (or another feature a single request can’t fill in).
429Too many entries from this network address. Wait a few minutes.

Troubleshooting

  • The Form list says “No published forms yet”. Publish the form first (Settings › Publish in the builder).
  • There’s no Form list next to Build a site with an agent. Your role can’t open Forms. Ask an admin.
  • The Web Builder built the site but no form. The form has more than one screen, a skill screen, routing to another screen, or a required upload. Its reply says which. Use a one-screen form.
  • The site shows an error instead of the thank-you message. The form was unpublished or deleted, or its field keys or option values changed after the site was built. Publish the form again, or open the site, pick the form and ask the Web Builder to update the form.
  • The site says the form is busy, or to try again later. The visitor’s network has sent too many entries in the last 10 minutes. Wait and try again.
  • Submissions says “You don’t have access to this form’s answers”. You need Can read form answers, or an owner or admin role. See Before you start.
  • The entry is there but a choice shows a code like battery. That’s the option’s Value. Change the value in the builder if you’d rather store something readable, then update the site as above.

Related: Users · Agent Management · Deploying agents