一种问题项,可让答题者从一组按编号排列的单选按钮中选择一个选项。可以从 Form 访问或创建项。在测验中使用时,这些项目会进行评分。
// Open a form by ID and add a new scale item. const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); const item = form.addScaleItem(); item.setTitle('Pick a number between 1 and 10').setBounds(1, 10);
方法
详细文档
create Response(response)
为此缩放项创建新的 Item。如果 response 实参超出为相应商品设置的界限,则抛出异常。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
response | Integer | 相应比例项的值回答 |
返回
Item - 商品响应
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
duplicate()
get General Feedback()
返回受访者回答可评分问题时向其显示的反馈。
返回
Quiz - 反馈(如果有)。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Help Text()
获取商品的帮助文本(有时称为布局项(如 Image、Page 和 Section)的说明文本)。
返回
String - 商品的帮助文本或说明文本
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Id()
获取商品的唯一标识符。
返回
Integer - 商品的 ID
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Index()
获取表单中相应商品在所有商品中的索引。
返回
Integer - 商品的索引
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Left Label()
获取比例下限的标签(如果有)。
返回
String - 比例下限的标签
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Lower Bound()
获取比例的下限。
返回
Integer - 比例的下限
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Points()
返回可评分项目的分数。
返回
Integer - 问题的分值。
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Right Label()
获取相应比例上限的标签(如果有)。
返回
String - 比例上限的标签
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Title()
获取商品的标题(如果是 Section,则有时称为标题文字)。
返回
String - 商品的商品名或标题文字
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Type()
get Upper Bound()
获取比例的上限。
返回
Integer - 体重秤的上限
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
is Required()
确定答题者是否必须回答问题。
返回
Boolean - 受访者是否必须回答相应问题
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Bounds(lower, upper)
设置比例的下限和上限。下限必须为 0 或 1。上限必须介于 3 和 10 之间(含首尾)。新比例的下限默认为 1,上限默认为 5。
如果给定的值超出允许的限值,则会抛出脚本异常。小数部分会被截断为前面的整数。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
lower | Integer | 新的下限 |
upper | Integer | 新的上限 |
返回
Scale - 此 Scale,用于链式调用
抛出
Error - 如果下限或上限无效
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set General Feedback(feedback)
设置在回复者回答没有正确或错误答案的可评分问题(即需要人工评分的问题)时向其显示的反馈。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
feedback | Quiz | 新反馈 |
返回
Scale - 此 Scale,用于链式调用
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Help Text(text)
设置商品的帮助文本(有时称为布局项(如 Image、Page 和 Section)的说明文本)。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
text | String | 新帮助文本 |
返回
Scale - 此 Scale,用于链式调用
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Labels(lower, upper)
set Points(points)
set Required(enabled)
set Title(title)
设置商品的标题(如果是 Section,有时称为标题文字)。
参数
| 名称 | 类型 | 说明 |
|---|---|---|
title | String | 新标题或标题文字 |
返回
Scale - 此 Scale,用于链式调用
授权
使用此方法的脚本需要获得以下一项或多项范围的授权:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms