简体   繁体   中英

Google Apps Scripts Form service

I want to know if there is any function in google app script form service for adding another choice to another different question when the answer of the first question is a certain choice

source.setTitle('Choose source')
source.setChoices([
source.createChoice('instagram.com'),
source.createChoice('facebook.com'),
source.createChoice('twitter.com'),
source.createChoice('facebook_instagram')])

medium.setTitle('Medium')
medium.setChoices([
medium.createChoice('CPC')])

var opcSource = source.getChoices();
var opc = opcSource[0].getValue();

if (opc === 'instagram.com'){
medium.createChoice('HELLOHELLO');

This will depend on your implementation. You can set the createChoice(value, navigationItem) and create a page where a certain choice item wil go.

Creates a new choice with a page-navigation option that jumps to a given page-break item. This is equivalent to createChoice(value, navigationType) with navigationType set to FormApp.PageNavigationType.GO_TO_PAGE . Choices that use page navigation cannot be combined in the same item with choices that do not use page navigation.

You'll have to set multiple pages for you to achieve what you want. You can check this related SO post for code implementation.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM