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 -
Plain HTML
iFrame
Comments
Is there a way to make fields required? Also, does the time have to be manually entered, or can the form add a time stamp for each submission?
Was this question ever answered? I also would like to know if Form fields can be required before a submission will be accepted. Thank you.
Hi Jeff!
This question was resolved within a ticket Mathias left - currently the author of the article is the only one who receives a notification if someone comments and I only saw this after updating the documentation.
We DO support automatic time entry! The default time if not entered manually by the user will display the time the form was submitted in UTC ( Coordinated Universal Time).
We don't support the functionality of mandatory fields at this time, however. We can consider this as a feature request. The standard process for those is for our users to submit the feature request to http://support.socrata.com/forums/84703-Feature-Requests where we triage them and make decisions about rollout and timing based on the needs of our customer base. Currently there has not been a request created in the forum so I created the request just now -
Feature Request link for required fields: http://support.socrata.com/entries/32685248-Form-feature-entry-required-fields. I recommend that all interested in updates subscribe to the post to receive notifications.
Thanks Kellie – your response time is always stellar.
Regarding time entry, I am interested in creating a “time stamp” column that records the time of form submission/data entry. Preferably, it would be hidden from view and would happen behind the scenes.
Let me know and I can make this a feature request.
Again, I appreciate your help.
Thanks for the note Jeff :)
It is currently not possible to have a separate column for time entry so if you could create a feature request for it that would be great!
I explored a workaround in the meantime to see if this was possible and found another piece of information which may be helpful.
I created a view with a hidden time column and created a form off of this view. The idea was that since entries through a form propagate down to the original underlying dataset, when a user hits submit the underlying dataset will have that date/time column populated. If this underlying dataset is private then this could have been a behind-the-scenes solution. However, I found that one CANNOT submit form entries to a view which contains hidden columns - an error message is returned.
Kellie, thanks for the reply and the attempted timestamp workaround. I did some experimenting on my end as well and discovered that exporting the data to RSS is one way of capturing when a row was updated. It appears the pubdate value in the RSS xml corresponds to when the row was updated (or, it's at least close!).
Sweet! That was one option I didn't think of - great idea and thanks for sharing! :)
Can the form, upon submission, also generate an email with the results?
Hi Chris!
If you were to subscribe to the underlying dataset the form feeds into, you would be notified of every new submission to the form. You can subscribe by clicking on the 'Subscribe via Email or RSS' button and checking the option to receive email notifications (http://support.socrata.com/entries/39799596-Social-media-configurations).
Is it possible to make the actual form private so that only select persons can fill it out and populate a dataset?
I should fine tune my request: Does the person you share a form with need to have a socrata account set up?
Article is closed for comments.