prepopulating google forms

3
© 2011 Jim Holland www.digitalgoonies.com Advanced Google Forms: Pre-populating Forms To pre-populate certain fields on a form, you need only to edit the URL you give to users. Each question in a form is assigned a parameter name: “entry_X” where X is the question number minus 1 (n-1). Remember, in programming most arrays start numbering at zero. This chart gives you some examples: Question Number* Parameter Name 1 entry_0 2 entry_1 5 entry_4 9 entry_8 *Parameter names are assigned to each question as soon as the question is created. If you later move your questions up and down to change the sequence, the parameter names do NOT change. This could lead to situations where the parameter names appear to be out of order when viewing the questions in your form from top to bottom.

Upload: jim-holland

Post on 23-Mar-2016

212 views

Category:

Documents


0 download

DESCRIPTION

Here's a quick run down of how to pre-populate Google Forms with values of your choosing by customizing the form's URL.

TRANSCRIPT

© 2011 Jim Holland www.digitalgoonies.com

Advanced Google Forms: Pre-populating Forms

To pre-populate certain fields on a form, you need only to edit the URL you give to users. Each question in a form is assigned a parameter name: “entry_X” where X is the question number minus 1 (n-1). Remember, in programming most arrays start numbering at zero. This chart gives you some examples:

Question Number*

Parameter Name

1 entry_0 2 entry_1 5 entry_4 9 entry_8

*Parameter names are assigned to each question as soon as the question is created. If you later move your questions up and down to change the sequence, the parameter names do NOT change. This could lead to situations where the parameter names appear to be out of order when viewing the questions in your form from top to bottom.

© 2011 Jim Holland www.digitalgoonies.com

Base URL: https://docs.google.com/a/aisd.net/spreadsheet/viewform?formkey=dGw3Z2o0Z2tuMTRZNWhURzBJei1uN3c6MQ Anything added to the base URL must include the ampersand (&) to indicate that you are sending values to the form. The basic syntax for sending a variable will look like this (without the <> brackets): <base url for the form>&<parameter name>=<value>&<parameter name>=<value>&<parameter name>=<value>&<parameter name>=<value>&<parameter name>=<value> Ex:

Text, Paragraph Text, Multiple Choice, Choose from a list These are the most common questions on a form and are filled in with default values with basic syntax: &entry_X=<text you want to appear in the text field by default> Ex: https://docs.google.com/a/aisd.net/spreadsheet/viewform?formkey=dGw3Z2o0Z2tuMTRZNWhURzBJei1uN3c6MQ&entry_0=Friendly Educator Note that in this example there is a space between the word “Friendly” and “Educator.” Most browsers can handle the space in the URL without the need for the %20 character. The %20 character may be added in lieu of the space if desired. Checkboxes Since there can be more than one checkbox selected by default, the syntax is a little different. Each of the entries that you want checked must be separated by the vertical bar (sometimes called “pipe”). &entry_X=<text value>|<text value>|<text value> Ex: https://docs.google.com/a/aisd.net/spreadsheet/viewform?formkey=dGw3Z2o0Z2tuMTRZNWhURzBJei1uN3c6MQ&entry_1=PC laptop|iPad Once again, notice the space between “PC” and “laptop.” Most browsers can handle the space in the URL without the need for the %20 character. The %20 character may be added in lieu of the space if desired.

© 2011 Jim Holland www.digitalgoonies.com

Scale The scale question type is simple in that your answer is going to be the numerical value of the rating of your choice. &entry_X=<number you want selected by default> https://docs.google.com/a/aisd.net/spreadsheet/viewform?formkey=dGw3Z2o0Z2tuMTRZNWhURzBJei1uN3c6MQ&entry_3=4 Grid The grid question type is the most complex. Before recent updates to Google Docs, you could determine the entry number by examining the source code of the page as such.

In this example, the syntax would have been… https://docs.google.com/a/aisd.net/spreadsheet/viewform?formkey=dGw3Z2o0Z2tuMTRZNWhURzBJei1uN3c6MQ&entry_6=average Currently, though, there is no way to pre-populate a grid question.