One of the great ways you can use your Socrata-powered data site is to gather input from your constituents using Socrata 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. If you make it private, you'll need to explicitly share your form with others using the sharing tool in order for them to submit to it.
Then click "Create" to create your form, and your browser will reload to display the new form that has been created -
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 Dataset in a Frame": This allows you to embed the form inside an iFrame, much like the Socrata Data Player. 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 are also given the regular customization options as with any embedded view on the Socrata Platform, which are given right below the embedding options:
- "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 -
Adding checkbox or dropdowns
If you go the dataset that powers the form and click on the red + sign to add a new column, you will have a Column Type section with a drop-down called "Data Type" in the yellow edit panel. Select the "checkbox" option to create a field with that data type. Multiple Choice columns can no longer be created on datasets and the function to create dropdowns in new forms is no longer supported. Existing drop-downs will continue to work as expected.