One of the great ways you can use your Data & Insights data site is to gather input from your constituents using forms. By creating a form, you can allow members of the public to submit entries to a dataset using a publicly-accessible form. Your form can even submit to a private dataset so that can you can review submissions without making them public.
To create a form, you should first start with a dataset that you want your entries to be submitted to. You can either design a dataset from scratch by adding your own columns, or you can base it off a dataset that you imported from an uploaded file. The columns in your dataset will be mapped to the form fields in the form that will be created, so make sure you have the right set of columns set up before you create your form.
Once you've got your dataset ready, you can create your form.
Creating a Form
Logged in as the dataset owner, click on "Embed" and then "Form".
You'll be presented with a few fields to fill out:
- "Name": The name that will be used for your form. The form itself functions like a filtered view or visualization, so it'll be shown in your profile page and data catalog.
- "Success URL": This is an optional URL you can specify that visitors will be redirected to after they fill out your form. You can use this to provide a "Thank You" page that they'll be sent to after they've submitted their response.
- "Public": By default, your form will be public. This means that anybody can submit to your form.
Note: Data & Insights no longer supports private forms.
Then click "Create" to create your form, this will open a draft of your new form which you can then publish.
Embedding Your Form
If you click on the "Embed" sidebar again, you'll see you've been provided two different embedding options:
- "Embed this Form as Plain HTML": This allows you to embed the form as raw HTML into your webpage. This gives you the greatest control over the layout of the form since you can remove form fields and control how it is styled using CSS. However, if you later go change the fields in your form by changing the names or order of your columns, they will not automatically be reflected in the form, and you'll need to update your form code each time.
- "Embed this Form in a Frame": This allows you to embed the form inside an iFrame. This option is recommended when the HTML is required to be self-contained. This is the recommended solution for embedding into Perspectives. Since the form is embedded in an iFrame, it will automatically update when you modify the columns in your dataset. However, you can't control the styling of the form using CSS.
You can also set size and template options to control the display of your form:
- "Size" - Select from 3 preset embed options
- "Custom Size" - You can also enter in custom dimensions
- "Social Data Player Template" - Select the embed framing style from a drop-down menu (these are determined by the site admins and designers)
Once you've embedded your form, test it once or twice to make sure it works on your website or blog. Then you're good to go!
Here is an example of a form embedded on a website -