回答編集履歴
1
サンプル追記
test
CHANGED
@@ -1,2 +1,32 @@
|
|
1
1
|
現在どのようなコードで選択肢を変更しているのか分かりませんが、選択肢を作成する際に
|
2
2
|
[createChoice(value, navigationItem) ](https://developers.google.com/apps-script/reference/forms/multiple-choice-item?hl=ja#createchoicevalue,-navigationitem)を使用して作成する必要がありそうです。
|
3
|
+
|
4
|
+
とりあえずのサンプルです。
|
5
|
+
```JavaScript
|
6
|
+
function creageChoice() {
|
7
|
+
|
8
|
+
let frm = FormApp.getActiveForm();
|
9
|
+
|
10
|
+
// セクションの一覧を取得
|
11
|
+
let sections = frm.getItems(FormApp.ItemType.PAGE_BREAK)
|
12
|
+
|
13
|
+
// セクションの中からタイトルが一致するものを取得し、PageBreakItemにする
|
14
|
+
let to_2 = sections.find(function(item) {return item.getTitle()=="第2セクション"}).asPageBreakItem();
|
15
|
+
let to_3 = sections.find(function(item) {return item.getTitle()=="第3セクション"}).asPageBreakItem();
|
16
|
+
let to_4 = sections.find(function(item) {return item.getTitle()=="第4セクション"}).asPageBreakItem();
|
17
|
+
|
18
|
+
let puldowns = frm.getItems(FormApp.ItemType.LIST);
|
19
|
+
// 最初のプルダウンリストの質問を取得
|
20
|
+
let pul = puldowns[0].asListItem();
|
21
|
+
|
22
|
+
// 選択しを作成する
|
23
|
+
pul.setChoices([
|
24
|
+
pul.createChoice('選択肢1',FormApp.PageNavigationType.RESTART),
|
25
|
+
pul.createChoice('選択肢2',to_2),
|
26
|
+
pul.createChoice('選択肢3',to_3),
|
27
|
+
pul.createChoice('選択肢4',to_4)
|
28
|
+
]);
|
29
|
+
|
30
|
+
}
|
31
|
+
|
32
|
+
```
|