Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic selection options in Google Apps Script for forms

I have this form:

Screen Shot

If you see List Items - Student Name and Grades are getting populated from a Google Sheet.

What I want to do now is upon selection of List Item Grade, show only those students that belong to that particular grade in the "Select Student" selection...

How can it be done, because form has only two triggers: onOpen and onEdit?

like image 222
user3082586 Avatar asked Aug 23 '26 04:08

user3082586


1 Answers

As far as I know, this type of client side event does not exist in Google Forms. The scripting mechanisms of Google Apps Script are designed for creating forms and other documents, but do not reach very far for client-side functionality.

What I suggest is that you split the form into multiple pages and use the "Go to page based on answer" feature to achieve your desired functionality.

Use form.addPageBreakItem() to create pages and use the item.createChoice(value, PageBreakItem) to navigate to the correct page.

References:

Google Apps Script Forms Service

addPageBreakItem

createChoice

like image 170
Jeremy Pullicino Avatar answered Aug 24 '26 21:08

Jeremy Pullicino



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!