hidden prefilled fields in google forms

3,493 views
Skip to first unread message

Bruce Mcpherson

unread,
Nov 18, 2020, 8:02:50 AM11/18/20
to Google Apps Script Community
Hi everyone - I realize this may be the first question I've actually asked on this forum. It's to do with Google Forms and hidden prefilled reponses. Here's the scenario
  • sheet 1 contains a mailing list and everyone on it has an ID
  • I have constructed a prefilled link for everyone on the sheet that includes this ID plus a bunch of other normal stuff
  • I want to hide this confusing prefilled ID field from the respondent,so I put this in a hidden section that is never visitable, but I need the original value to be in the form response sheet so that I can match up responses to the original mailing list via the ID
  • if the form section is hidden, the repondent never sees it, but it means that the original prefilled value is not returned, and is instead blank.
I can't find a way of retrieving and investigating that prefilled value even with an onSubmit trigger. 

I assume many of you have come across this basic issue before and have an obvious solution that I'm missing to hand. Any ideas?

thank you
bruce

Adam Morris

unread,
Nov 18, 2020, 8:54:14 AM11/18/20
to google-apps-sc...@googlegroups.com
Hi Bruce,

I also was trying to solve this problem a while ago. I also remember trying to use a hidden section and finding it odd that a prefilled doesn't seem to remember its value if it's in a section the respondent doesn't navigate to. (Although I wonder if it's probably a security thing, to ensure the user has a chance to review all submitted info, so that it's not personal info ...)

There is no way to hide anything on a google form, and since javascript is a no-go there's no way to do that, either.

The only thing I could come up with is a workaround. I snuck in the ID I needed so that the user's eyes would immediately look for the submit button and gloss over the ID that was snuck in there:

image.png

A simple description added to it to ensure the user understands that changing the value would "break things" was enough. 

But this was not a mission critical application. I'd be wondering if there is a more CSy solution.

Adam

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/cd89a4c2-4d13-4811-9645-ddec65702aa4n%40googlegroups.com.

Alan Wells

unread,
Nov 18, 2020, 9:17:02 AM11/18/20
to Google Apps Script Community
The only way that I know of that would work is to have pre-submitted responses in the Sheet.
The Sheet would either need to be linked, so that subsequent responses get written to the correct row,
or you'd need to record the Form response ID, and match up the Form response ID on subsequent submissions.
If the Form is linked to a Sheet, then an edit (Form resubmitted) somehow automatically gets written into the previous row.
I think that the following is true, but test it for yourself it you think it might work.
If you first link the Form to the Sheet, then add a column, that added column gets skipped over when the new response is saved.
So, you can put your own values into cells in that added column.
So, the way that you would know that the Form response is matched to that persons ID, is simply that Google Forms somehow knows
what is the correct row to overwrite when the Form is resubmitted.
You don't need to prefill the user ID in the Form and then somehow get it back.
If the Sheet isn't linked to the Form and there are not original submissions, then this won't work.

Adam Morris

unread,
Nov 18, 2020, 9:35:21 AM11/18/20
to google-apps-sc...@googlegroups.com
That’s an interesting angle. So basically you’d be using the response form ID as the unique value. Right? Submit forms in advance and users just resubmit, right?

Bruce, is this ID a foreign key to another table? In other words, could you use any response ID or is the ID predetermined from somewhere else?

--

Bruce Mcpherson

unread,
Nov 18, 2020, 9:55:22 AM11/18/20
to Google Apps Script Community
Thanks all
The key already exists - I guess i could map it to something else but it seems fragile. Also there are hundreds of rows, so the prefilled link is create automatically from each row. I get the idea of the presubmitted form with an edit link rather than a form link is an (lateral thinking)  interesting idea, but if there are required answers on the form, you'd need to make up initial required answers hoping that wouldn't be biased or confusing (it would be).

hidden fields or even some way to reasonly a field seem a pretty necessary feature - surprised they aren't there in some way. I wondered if the submitted prefilled url might be findable somehow but I can;t find an apps script way of accessing that either from the perspective of the form either.

Mani Doraisamy

unread,
Nov 18, 2020, 10:08:26 AM11/18/20
to Google Apps Script Community
Hi Bruce,
As others mentioned, it is not possible to hide fields in Google Forms. But, Formfacade addon allows you to do that - https://formfacade.com/website/is-it-possible-to-hide-fields-in-google-forms.html (Disclaimer: I wrote it). Hope that helps.

thanks,
mani

Kim Nilsson

unread,
Nov 18, 2020, 10:16:24 AM11/18/20
to Google Apps Script Community
The bit about Forms not remembering previous information is super important if you have an editable form that users re-visit to fill in a second/third/more time/s.
In my experience... Unless the user re-visits all the sections, any data in a skipped section will be lost.

Bruce Mcpherson

unread,
Nov 18, 2020, 10:22:08 AM11/18/20
to Google Apps Script Community

Hi Mani

yes thanks - I had a look at that but I'd like to try to find a native solution first

cheers
bruce

Clark Lind

unread,
Nov 18, 2020, 3:18:36 PM11/18/20
to Google Apps Script Community
Bruce, I usually end up dealing with this issue after receipt and set the trigger there (onFormSubmit). Typically, I'll have a separate tab for a lookup based on something else unique (like email address) and then add the userID to the response field or cell. Just a bandaid solution really, but it works even if clunky.

Clark Lind

unread,
Nov 18, 2020, 4:27:46 PM11/18/20
to Google Apps Script Community
If you want anything beyond simple functionality, you are better off just creating a webApp and serving the form via html. You'll spend less time than trying to find a solution and giving up and going with your own form anyway :)

Bruce Mcpherson

unread,
Nov 18, 2020, 6:37:13 PM11/18/20
to google-apps-sc...@googlegroups.com
Yes, I don’t want to do a web app as I won’t be maintaining it going forward, so want to hand something vanilla over. 

All the solutions are a little hackish aren’t they, but judging by the all the comments it seems like a rather odd omission not to be able to reliably tie a pre filled form back to its source.

Thanks for all the suggestions.


Alan Wells

unread,
Nov 18, 2020, 7:25:17 PM11/18/20
to Google Apps Script Community
For anyone interested, there is a Feature Request that is related to an issue discussed in this thread.

Bruce Mcpherson

unread,
Nov 19, 2020, 4:50:00 AM11/19/20
to google-apps-sc...@googlegroups.com
Thanks Alan - I've starred it. 

Edward Wu

unread,
Nov 19, 2020, 1:36:20 PM11/19/20
to google-apps-sc...@googlegroups.com
Instead of trying to hide the info/section, maybe just include it in a "FOR OFFICE USE ONLY" type of section at the bottom of the form so people know to just ignore it?


Bruce Mcpherson

unread,
Nov 20, 2020, 7:59:08 AM11/20/20
to google-apps-sc...@googlegroups.com
Yes _ i've done that - but you can;t make it readonly - so you can't completely rely on the content for matching up later. If you could at least make it non changeable that'd work

bruce

Clark Lind

unread,
Nov 20, 2020, 11:18:03 AM11/20/20
to google-apps-sc...@googlegroups.com
I know you don't want it on the form, so maybe you can use it to your advantage. In the email that gets sent, include the number there as a security measure, and on the form, have a "Security Check" that for security purposes, they have to copy and paste the unique code sent only to them to ensure their security and Identity. After all, we are interested in your privacy... blah blah blah. Turn this shortfall into an asset. :)

You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/mqfCDX9Ldxg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CANijH0WTest5PRfETze%3Dh%2B5W5Y%2BpoX70g9fd1AcPtymcTHPY%2Bw%40mail.gmail.com.

Bruce Mcpherson

unread,
Nov 20, 2020, 11:21:44 AM11/20/20
to google-apps-sc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages