In the previous blog post, I showed how we get data from a Form and render it into a Google Document.
In this post, I want to show how the Document, as it is created can have a link appended to it to another Google Form that will be used for marking that document. We have used this where people are submitting application forms and lecturers are grading those applications.
First, create your new evaluation form, deciding what field will be autopopulated with data from the application form, for example, student name and institution etc. Also add the form items you want to use for marking, which might include drop down menus or multiple choice or paragraph text areas.
and then select then choose the menu Responses > Get pre-filled URL. Once you have filled in this form you will be able to add some code to your Google Spreadsheet like this... and work out which value you need to map onto the bit that says... entry.1021949580 ...obviously all of these will need changing for your values and email.
function make_prefilled_url ( values ){
var title = values['Title'][0]
var firstname = values['First Names'][0]
var surname = values['Surname'][0]
var institution = values['Institution'][0]
var department = values['Department/School'][0]
var mode = values['Mode of Study'][0]
var university_id = values['University ID Number'][0]
var condition = values['Has an offer of a place of study already been received'][0]
var project_title = values['Project Title'][0]
var project_summary = values['Project Summary'][0]
var url = 'https://LINK_TO_YOUR_EVALUATION_FORM/viewform?'
url+= "entry.1981746791="+ url_escape (title )
url+= "&entry.522456082="+ url_escape( firstname)
url+= "&entry.1635227300="+ url_escape( surname )
url+= "&entry.1575537957="+ url_escape (institution )
url+= "&entry.1021949580="+ url_escape( department )
url+= "&entry.1125873153="+ mode
url+= "&entry.1336223027="+ url_escape( university_id )
url+= "&entry.582559888="+ condition
url+= "&entry.303787572="+ url_escape( project_title )
//url+= "&entry.1796510964="+ url_escape( project_summary )
return url
}
function url_escape(s){
var s = encodeURIComponent(s)
return s
}
Once you've worked out how to create a pre-filled URL, you can then go back to the code that generates the Google Doc ( the application form ) and make sure that each document has a link to the evaluation form.
This shows you how to add a link to a Google Doc.
function onFormSubmit(e){
// Get values
var values = e.namedValues
<<< Your other code here to generate your Google Doc >>
//Append an pre-populated form URL to the new document
var eval_url = make_prefilled_url(values)
var link_text = "To evaluate this application, click here"
var par = new_doc.getBody().appendParagraph(link_text)
par.editAsText().setLinkUrl(0, link_text.length -1 , eval_url)
It's difficult to give you copy-and-pastable code to do this because it's a bit messy, but workable enough and once you understand the concepts, it allows you to easily chain forms and processes together, making a much smoother experience for everyone involved.
Wednesday, October 9, 2013
Linking a Google Doc To a Form For Assessment
4:34 AM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment