8

Is it possible to edit Google Forms to allow data validation and use of some javascript or similar tools on it to give an advanced feel to the form. While making sure that the form isn't removed from the google environment or atleast is able to feed it's data to a google spreadsheet.

Ali Afshar
  • 40,967
  • 12
  • 95
  • 109
Rijo Simon
  • 777
  • 3
  • 15
  • 35

3 Answers3

5

It is possible to do that but it is not a very "clean" way to do it. You can create a form with Google form and using HtmlService to parse through the html with the link and from there you can add in more html/javascript with it. This trick is possible for now but if there is any changes to Google Form html structure, it will break this.

shh
  • 682
  • 1
  • 5
  • 20
  • Guys to rephrase my question what I am looking for is how to edit the google form programmatically. I want to what classes, package or API to use for it. Can explicitly answer that. If possible provide links to these resources. – Rijo Simon Jul 10 '12 at 17:35
  • First you will need to use UrlFetchApp.fetch(myFormUrl).getContentText() to get the HTML code from your Google Form. Next, you can modify the codes with replace and stuff. Lastly then you will use HtmlService.createHtmlOutput() with the fetched HTML. As there is no direct way or even documentation for this because this is a "hack" trick and it may break anytime if the html structure in Google Form changed. – shh Jul 10 '12 at 22:08
2

Ok I figured this. You can simply take the section within ... and paste it to your webpage and it will still interact with its Google data source, the spreadsheet. There after you can use any web tool to edit the form itself, like html, javascript, ajax etc. But there are a few things you should know about this method:

  1. If you want to add a new field you will have to add that in the actual google form and then once again copy the ... and redo all the work you did on it before. So this is a bad method if you know that you gonna keep adding new fields all the time.

  2. Make sure you don't change any google related terms like class names of the tags, form action parameters etc. I think the kind of work that you can do over it, which is perfectly acceptable are those that allow changing the look and feel of the form and its peripheries.

Rijo Simon
  • 777
  • 3
  • 15
  • 35
1

Sort of... You can create a very sophisticated form using Google Apps Script. For someone with experience and a library this can be as short as an hour. If you're starting from scratch it will take considerably more time (the learning curve for an Apps Script novice can be a bit high).

We have found that if we are delivering the custom form to people within our domain Google Apps Script works great. If we need to collect information from the general public and can collect it using a regular Google form, that also works great. However, if we need to collect information using an Apps Script from people outside of our domain we use another service (not Google).

Best of luck.

JKWA
  • 313
  • 2
  • 9
  • I have been looking into using Google App Scripts, I wont say I am novice with it, since I did one project on GAS involving workflow approval. But I just am not able to find any credible resource which can give me some foundation on how to customize forms using Google App Scripts. – Rijo Simon Jul 09 '12 at 23:26