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
I assume you're only interested in ways to programmatically assign a unique ID before the user fills out your form.
No, Google Forms still has no direct support for hidden fields such as you have in HTML Forms. Your only option appears to be the custom styling route, which you're already aware of.
Here are two promising ideas that just don't work...
Pre-fill a deleted question. If you delete a question from a form, it remains in the response spread sheet - unfortunately Forms suppresses values for deleted questions that are presented in pre-filled URLs, otherwise you'd be able to trick your Unique ID into the submission that way. (I thought this might be a clever work-around, but was disappointed that it didn't work.)
Pre-fill a question on a skipped page1. You can set up a question on a second page that the live form will skip over, and you can also generate a pre-filled URL for that question. So far, so good - but if the user doesn't actually navigate to that page, the pre-filled response is not submitted.
1Thanks to @AdamL, who posited this idea during a previous discussion on this topic in the old forum.
The best you can do is to go to settings in the top right corner and click "Collect Email Addresses" this won't collect it but it has a validator and asks the respondent to fill in an email-filtered short answer question.
I’ve bumped into this same problem and there doesn’t seem to be any ready-made solution. Until Google decides to support hidden fields, there’s nothing we can do apart from considering other unusual approaches.
I’ve come with one of those. It’s an un optimal solution, but it works. Bear with me.
There is always a hidden key with an unique value in every form. Its own ID.
If you can map trackable values with form IDs, you’re half way there.
Here’s my problem and here is what I’ve done.
I need to share a form to a group of users. All forms need to be identical, and users are allowed to share the form link to other people. I want to track the referrals so a hidden field that could be pre-filled and customized for each first degree user with a unique ID, would FD be optimal. But that doesn't work, so what I've done is:
In this way, I have as many "instances" of the same form that I share individually to every single user (this can also be done programmatically if you have the emails mapped to the referral codes).
When any form is submitted, its linked sheet is updated. Using the spreadsheet "on form submit" event, I run an utility in GAS that appends all the values plus identification of the response and form, to a special sheet that serves as summary. This way I just need to look at just one sheet to see all the results from every form, and analyze it.
Obviously, this is hard to maintain if changes are introduced to the original template form. But, for me, it works as temporary solution.
Hope it helps.
You can't do this directly by Google Forms but you can work around:
Insert the following code into the default Code.gs file. (This basically opens an index.html template.)
doGet(e) {
return HtmlService.createTemplateFromFile('index').evaluate();
}
Create a new index.html file with the source code of your form.
style="display:none"
to its enclosing <div>
<input value="">
field using <?= your_gscript_code() ?>
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.
I think I've found a solution to your problem. A script on the sheet that your form data is going to can be triggered on form submit. You can then copy and increment a "range" for each row submitted.
*edit, sample code was requested. In order for this code to work you need to "install a trigger" using the resources menu on your google app script, and use "from spreadsheet" "on form submit". I've boiled what I'm doing down to the following snippet.
function myFormUpdates(e) {
var spreadsheet = SpreadsheetApp.getActive()
//select the sheet you're form is going to post data to
var sheet = spreadsheet.setActiveSheet(spreadsheet.getSheets()[1])
//select the last row and a unused column
var cell = sheet.getRange(sheet.getLastRow(), 3)
//set data
cell.setValue('Data')
}