Google Classroom
GeoGebraGeoGebra Classroom

Passing Values to Google Form

Submit any values or strings to a Google form (working as at May 2022)

On-click JavaScript of the "Submit" button

if (confirm("Confirm to submit?")) { postDataToGoogle( ggbApplet.getValue("ID"), ggbApplet.getValueString("sname"), ggbApplet.getValue("n1"), ggbApplet.getValue("n2"), ggbApplet.getValue("n3"), ggbApplet.getValue("n4")); }

Global JavaScript

function postDataToGoogle(ID,sname,n1,n2,n3,n4) { var formURL = "https://docs.google.com/forms/d/1ISxJ5EFGRJ8DJkJ_fZBVJFZSLb1U2AdVpDKrva9e_fs/formResponse"; if (sname!=="") { $.ajax({url:formURL, data: { "entry.1832159614":ID, "entry.1078480704":sname, "entry.118362476":n1, "entry.825951479":n2, "entry.310748160":n3, "entry.2121488058":n4}, type: "POST", dataType: "xml", statusCode: {0: function(){alert("Successful!");}, 200: function(){alert("Failed!");}}}); } else {alert("Data missing!");} } Note: 
  1. The URL of the google ends with "/formResponse" instead of "/viewform".
  2. The entry IDs of the Google form can be checked by an extension in Chrome browser called "Web Developer".

Use of Web Developer

Use of Web Developer

An Example: Rounding Quiz (with marks submission)

gMath 互動數學教室 http://www.gmath.hk