Updating Google Form Drop down values on load - google-apps-script

Is there anyway to update drop-down values of some Google Form items when users are loading the form? I know onOpen is just for openning the form in edit mode, but Just wanted to be sure weather is any workaround for this or not? if so, What would be then the alternatives? Using web form for instance, which is totally different approach maybe!?
Thanks,
M

Related

Is there a way to edit a Google Form using apps script while it is being filled out? [duplicate]

I have a questionnaire created using Google form. When the user fill in the answer, some questions should be skipped based on the answer of some previous questions. While I can trust the user that they will follow the instruction, I feel that I can improve it by hiding the questions.
I know I can do that by separating the questionnaire into pages and use the default "go to page" function provided by Google form. However, as there are too many questions of this kind, I don't want the user to wait for page loading after nearly every question. Sadly, there is no default option to show/hide a question based on user choice in Google form.
Then, I found that there is a Google app script thing. I guess it can help me to implement such basic things, but then I am frustrated that I am not even able to locate an object in the questionnaire, and it seems it lacks a function to control the visibility of a question objects. (or at least, not found in the menu)
The link to the menu provided by Google:
https://developers.google.com/apps-script/reference/forms/
I am completely lost now. I have Google and search here in Stack Overflow, but nothing's found. Any idea on how can I proceed?
We can't currently access or manipulate any items in a live Google Form, with Google Apps Script, as the user is filling it out. Only the Google Form builder can be programatically controlled. A script can either help build a form before it's opened or be setup to trigger a function to run after a response has been submitted. See quickstart for working with Google Form responses and the Add-on example for the Google Form builder.
To dynamically show form items or change input values as users are filling it out:
Build and deploy your own web app that acts like a form with HtmlService ( hosted on script.google.com )
Build a regular HTML form hosted on your own service.

How would I implement for loop using google script to edit a google form?

I am very new to scripting on Google form. In fact, I just recently fount out about it.
So what I'm trying to do is that I want to create a form that consists of duplicated pages in accordance to a number that is chosen by the user.
For instance, the form asks the user "How many people will be participating in this event?" If the user types in 5, the form will make 5 duplicates of a page, in which all of those pages will ask for the details of each participant.
So is there a way create duplicates of a page using a for loop?
First, you'll need to implement using installable form-submit trigger which runs when a user responds to a form.
For more information, check these two versions of the form-submit trigger:
Google Forms events
Google Sheets events
Then, when triggered, you may want to create new documents using the append methods in Class Body.
See this related SO posts for more insights and sample codes:
Duplicating a page of a document and replacing text on each page
Google app script copy document page

Customize confirmation page after submitting google form

I have this google form (just using google drive), this is like a test with multiple choices, so the thing is when a user completes the form and clicks on submit button, I want the confirmation page shows the test results.
Is it possible?
I try using creating scripts and using events and triggers, but I'm start to thinking I've misunderstand its usefulness.
Thanks in advance.
Yes, you can create a form with Google Apps Script and show the results at the end. Events and triggers may not be the right way to go, but you can try your hand at UiService with which you can create your forms.

Google Forms Script to Move User to New Page in the Form

If I have a Google Form, how might I use Apps Script to:
1.) Get the user's responses to questions on one page of the form
INTERJECT SCRIPT LOGIC
2.) (pause) the form and have the script activate to:
process their results
depending on the result of that processing, move them to a different page
Basically, I want to have the script analyze the results of a particular page, and redirect them to a new page depending on the results to multiple answers. There is a redirect utility in the form itself, but it only works for the result of one question. I have two questions that I need to ask, and based on both of those answers, move them to a new page.
I know that I can create Items that have a PageNavigationType as seen here, however, this is for a single item only. There is also no setPageNavigationType for Items, so I'm wondering if this is even possible to do dynamically as a user is filling out the form?
Hate to be the one to give the bad news, but that's not possible.
Google Apps Script only helps with the Form creation process (and editing), it's not possible to do anything while the user is filling it, period.
Also, it can only do programatically what you can do manually on the Form interface, it's useful only to help you automate things that would be cumbersome to do manually. For example, adding a long list of options to a question, or helping you generate and email hundreds of similar Forms. Or just really creating quick quizzes or some other forms that you have to create every week, etc.
Just to be completely clear to other users that might read this. It's not possible to do anything with Apps Script for Google Forms that you can't already do manually. Apps Script does not add any new or hidden features to Google Forms.

Google Form Confirmation Page with a Button to Create a Report, via Browser Access

I have created a Google Form. From the Confirmation page I would like to create a button that says "See Test Score". At that point I want to create a report of sorts, accessible via a browser, using apps script. The report would access data from a Google Spreadsheet via apps script. I just need to figure out a way to create the report. The report data will mostly be in table format but I may want to add a graph or two. Any help would be appreciated! Thank you!
You cannot do this using a Google Form. However, what you can do is write a UI using Google Apps Script which has the same fields as your form. You can customize this UI a lot more where you can show a report on the confirmation screen etc.
I suggest you go through the Google Apps Script tutorials and start writing your UI. If you get stuck or need help, come back with the issue you're facing