Can I use a user-entered text value in one section of a Google Form to populate checkbox options in the next section? - google-apps-script

I'm trying to figure out if this is possible and if so any help on how to make it happen would be amazing. If not, I'd love to get an idea why it's not possible. I'm a novice and looking to learn! :)
I want to take a text response to one question in the first section of a Google Form and use that to populate checkbox options from a Google Sheet in the next section.
Basically, people check equipment out from my office for use with students and they can submit the form for extensions. I sometimes get confusing responses and would like to give them checkbox options based off the students' ID they enter in the first question.
Is any response information even available to use before the form is submitted?

Related

How to record data that is in a hidden section with prefilled link Google Form

How to record data that is in a hidden section with prefilled link Google Form
I have a form with 3 sections. The first section is for the user to input answers, after this section the users will be redirected to the third section and skip the second section. The second section is a hidden section that users will never redirected to this section. The third section contains only description then submit the form.
I prefilled the input in the second section using Google Form feature, then share the link to people.
After the user submits, I expect all input to be recorded to Spreadsheet (including the input in the second section), but actually it only records the first and third section. The section which the user has never visited is not recorded.
So, how can I still record the data in the hidden section even when the user has never visited?
Thanks in advance!
The Forms Service allows you to use Google Apps Script to access users' responses to a form. If the user hasn't responded, there will be no response. You can't access a response that doesn't exist. If you are prefilling the response yourself, may I ask why you need to record your own prefilled response?
Thanks for clarifying #Fanny Hasbi. Since you are only using the hidden section to store constant data and not user input, you would be better off passing your data to whatever script you are running on form submit.
I'm running into this exact same issue, and I'd love to find a solution where this is possible. However, in the meantime, I've found a workaround and I wanted to share it here, even though it's been some time since your original question.
Instead of creating the question that you need for internal tracking info as a text item, instead create it as a multiple choice item, with only a single answer. Pre-fill that answer with the URL, and make the answer required. When the user accesses the Form, the answer will be chosen, and they won't be able to edit the text.
This is obviously less elegant than having a hidden section where the user doesn't see the internal data, but given Forms' limitations, this may be the best option for now. Here's how I have it set up in my script:
form.addMultipleChoiceItem()
.setRequired(true)
.setTitle('ID')
.setHelpText('(for internal tracking purposes only)')
.setChoiceValues([internalId]);
When you create the response for the prefilled URL, it's the exact same method as creating a response for a text item, so your script wouldn't need changing in that regard.
Hope that helps someone!

Looking to make an HTML form with and edit field connected to a list

I would like to preset an HTML page that has list box (scrollable) that is connected to an edit field. Every time the edit field is updated the list box should show only the items that match the text pattern in the edit field.
Am sure it's possible but not even sure what it's called and all my Google attempts have failed.
Thanks
For anyone who comes across this same question, the term that I was looking for was "creating an autocomplete form."

Is it possible to generate an autofill script for Google Forms?

I want to create a script to autofill based on what the respondent is filling out in a short answer or even just suggest text in a dropdown.
For example, there are over 300 different codes, which makes scrolling through that drop down list very annoying.
I want the script to had the ability to suggest an autofill once a user is attempting to type in an answer. For example, typing "T00F1..." would suggest autofilling the rest to "T00F17T0"
That way i prevent that the respondent write wrong the code
If it is not possible, what alternatives do you recommend to generate this type of forms?

Google Form Script Submit After Response Populate Form with previous entry

I have created a Google Form for new students to sign up for our classes. The Form is set up to Submit After Response, starting the form over with all of the fields cleared and reset. I would like to add a script on submit that, if the user selects Submit After Response, that the Form would populate a majority of the same fields, while clearing and resetting some of the others. This is because when a parent signs their children up for their classes, I don't want them to have to enter all their contact info each time they add a new child.
The form in question can be found here: https://docs.google.com/forms/d/1NXBrs7zydaWsOvVlQMC8OXRykzT2fryXhiCASl21FG0/viewform
Any help you can provide will be greatly appreciated. Thanks!
Unfortunately, at this time it is not possible to manipulate an active Google form with Google script during user submission. About the only thing you can do with GAS regarding forms, is create and alter the makeup of a form during its initial development.
It's a bit confusing, but I've searched everywhere for exactly what you are trying to do. What I ended up doing was creating a Google web app and then deploying it for public use. A lot more manual work but a lot more customizable.
Maybe alternatively what you can do is, since all you want to do is make the submitting for the parents a lot easier, add several similar fields for something like 'Child 1', 'Child 2', 'Child 3', etc. and before each page for the new child, have the form ask the parent of there is another child, and depending on their answer you can have them progress to the next section of form. Now with this style, you could have multiple students per row of data in your presiding spreadsheet, so you'd either have to manually alter the spreadsheet at a later time, or create a spreadsheet script that automatically manipulates the data for you as needed. This is probably your best bet.

Grab current selection from a google form section

I have a google calendar that lists multiple free classes that are available each month. Currently the way people sign up is that they click on a link to a google doc and enter their names, but a blank work doc with names isn't very professional. Instead I'm created a google form that will send the responses to an excel spreadsheet, but need some help.
Currently the form first question asks "what date is the class you'd like to addend?" - Is there any way I can get the users response to that first question without having them submit the form?
Essentially I'd like for them to enter the date and use the getEventsForDay(date) function to create the second question dynamically populated with the calsses for the date they selected. Then have them choose the class with radio buttons. Is there any way to do this or would I have to have them select a date and then from that submit spawn a new on the fly form that then would list the classes for the date they selected?
For what I know you can't do that in a single form. You will need to do it with 2 forms. You can prefill the other form with some informations of the first form to make the bond.
But the best solution is: not to use the Google Forms and build your own form in apps script. Here an example and the code here.