Hidden field in a Google Form

后端 未结 5 1166
面向向阳花
面向向阳花 2020-11-30 02:52

I am adding a unique ID to each submission of the form. Right now, I made that ID the first field, and pre-filled it with the ID, along with a help text asking the user not

5条回答
  •  感动是毒
    2020-11-30 03:46

    You can't do this directly by Google Forms but you can work around:

    1. Create the google form containing the hidden field.
    2. Create a Google Wep App (https://developers.google.com/apps-script/guides/web)
    3. Insert the following code into the default Code.gs file. (This basically opens an index.html template.)

      doGet(e) { return HtmlService.createTemplateFromFile('index').evaluate(); }

    4. Create a new index.html file with the source code of your form.

    5. Make the input field hidden by adding style="display:none" to its enclosing
    6. Insert any template information into the field using
    7. Publish the web app (Publish/Deploy web app...) and you're done. Now you have a link to a form which has the desired field hidden and pre-filled with your hidden value.

    With this solution you can apply any custom style and even get rid of other unnecessary html elements while keeping the form hosted by Google.

提交回复
热议问题