Skip to content

Form Markup

Ryan Wold edited this page Aug 31, 2020 · 3 revisions

This page describes how a Touchpoints form works and how embedding a form interacts with your website.

Alternatively, a Touchpoint can be hosted on the site itself, alleviating the need to embed a form on your website.

How to include a Toucphoint form on my web page?

After publishing a form, a script will be displayed. Copy the script to your page. When your webpage loads, this script will also load. Read the next section learn about what happens in the script.

<script src="https://touchpoints-demo.app.cloud.gov/touchpoints/776439e8/js" async></script>

What happens in the script?

When the javascript loads, a function called FBAform() is written to the webpage's DOM, followed by a call to the function.

  1. Specify the formOptions. Only modalButtonText for now.
  2. create a new FBAForm object and pass it the document, window. Then initiate it with your Form Options.
var formOptions = {
  'modalButtonText': "How can we improve this site?"
};

var touchpointFormName = new FBAform(document, window).init(formOptions);

The following markup is appended onto the current page:

Clone this wiki locally