Enum ItemType
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
项类型
表示支持的表单项类型的枚举。您可以通过 FormApp.ItemType
访问项类型。
如需调用枚举,您可以调用其父类、名称和属性。例如
FormApp.ItemType.CHECKBOX
。
// Open a form by ID and add a new section header.
const form = FormApp.create('Form Name');
const item = form.addSectionHeaderItem();
item.setTitle('Title of new section');
// Check the item type.
if (item.getType() === FormApp.ItemType.SECTION_HEADER) {
item.setHelpText('Description of new section.');
}
属性
属性 | 类型 | 说明 |
CHECKBOX | Enum | 一个问题项,可让受访者选择一个或多个复选框,以及一个可选的“其他”字段。 |
CHECKBOX_GRID | Enum | 一种题目项,以列和行的网格形式呈现,可让回复者从一系列复选框中为每行选择多个选项。 |
DATE | Enum | 允许回复者指明日期的问题项。 |
DATETIME | Enum | 一个问题项,可让受访者指明日期和时间。 |
DURATION | Enum | 一种题目项,可让受访者指明时长。 |
GRID | Enum | 题目项,以列和行的网格形式显示,可让回复者从一系列单选按钮中为每行选择一个选项。 |
IMAGE | Enum | 用于显示图片的布局项。 |
LIST | Enum | 一种题目项,可让受访者从下拉列表中选择一个选项。 |
MULTIPLE_CHOICE | Enum | 一种题目项,可让受访者从单选按钮列表或可选的“其他”字段中选择一个选项。 |
PAGE_BREAK | Enum | 用于标记页面开始位置的布局项。 |
PARAGRAPH_TEXT | Enum | 允许回复者输入一段文本的问题项。 |
RATING | Enum | 允许回复者评分的题目项。 |
SCALE | Enum | 一种题目项,可让回复者从编号的单选按钮序列中选择一个选项。 |
SECTION_HEADER | Enum | 用于直观地指示某个部分的开始的布局项。 |
TEXT | Enum | 允许回复者输入单行文本的问题项。 |
TIME | Enum | 一个题目项,供回复者指明一天中的时间。 |
VIDEO | Enum | 用于显示 YouTube 视频的布局项。 |
FILE_UPLOAD | Enum | 一种题目项,可让回复者上传文件。 |
UNSUPPORTED | Enum | 目前不支持通过 API 执行的操作。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003e\u003ccode\u003eItemType\u003c/code\u003e is an enum representing the types of items you can add to a Google Form, such as questions, images, and page breaks.\u003c/p\u003e\n"],["\u003cp\u003eYou can access \u003ccode\u003eItemType\u003c/code\u003e properties like \u003ccode\u003eCHECKBOX\u003c/code\u003e, \u003ccode\u003eTEXT\u003c/code\u003e, and \u003ccode\u003ePAGE_BREAK\u003c/code\u003e using \u003ccode\u003eFormApp.ItemType\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eEach \u003ccode\u003eItemType\u003c/code\u003e property represents a different kind of form element you can add and manipulate using Apps Script.\u003c/p\u003e\n"],["\u003cp\u003eUse \u003ccode\u003eitem.getType()\u003c/code\u003e to determine the type of an existing item in your form and adjust its properties accordingly.\u003c/p\u003e\n"]]],[],null,["# Enum ItemType\n\nItemType\n\nAn enum representing the supported types of form items. Item types can be accessed from [FormApp.ItemType](/apps-script/reference/forms/form-app#ItemType).\n\nTo call an enum, you call its parent class, name, and property. For example, `\nFormApp.ItemType.CHECKBOX`.\n\n```javascript\n// Open a form by ID and add a new section header.\nconst form = FormApp.create('Form Name');\nconst item = form.addSectionHeaderItem();\nitem.setTitle('Title of new section');\n\n// Check the item type.\nif (item.getType() === FormApp.ItemType.SECTION_HEADER) {\n item.setHelpText('Description of new section.');\n}\n``` \n\n### Properties\n\n| Property | Type | Description |\n|-------------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `CHECKBOX` | `Enum` | A question item that allows the respondent to select one or more checkboxes, as well as an optional \"other\" field. |\n| `CHECKBOX_GRID` | `Enum` | A question item, presented as a grid of columns and rows, that allows the respondent to select multiple choices per row from a sequence of checkboxes. |\n| `DATE` | `Enum` | A question item that allows the respondent to indicate a date. |\n| `DATETIME` | `Enum` | A question item that allows the respondent to indicate a date and time. |\n| `DURATION` | `Enum` | A question item that allows the respondent to indicate a length of time. |\n| `GRID` | `Enum` | A question item, presented as a grid of columns and rows, that allows the respondent to select one choice per row from a sequence of radio buttons. |\n| `IMAGE` | `Enum` | A layout item that displays an image. |\n| `LIST` | `Enum` | A question item that allows the respondent to select one choice from a drop-down list. |\n| `MULTIPLE_CHOICE` | `Enum` | A question item that allows the respondent to select one choice from a list of radio buttons or an optional \"other\" field. |\n| `PAGE_BREAK` | `Enum` | A layout item that marks the start of a page. |\n| `PARAGRAPH_TEXT` | `Enum` | A question item that allows the respondent to enter a block of text. |\n| `RATING` | `Enum` | A question item that allows the respondent to give a rating. |\n| `SCALE` | `Enum` | A question item that allows the respondent to choose one option from a numbered sequence of radio buttons. |\n| `SECTION_HEADER` | `Enum` | A layout item that visually indicates the start of a section. |\n| `TEXT` | `Enum` | A question item that allows the respondent to enter a single line of text. |\n| `TIME` | `Enum` | A question item that allows the respondent to indicate a time of day. |\n| `VIDEO` | `Enum` | A layout item that displays a YouTube video. |\n| `FILE_UPLOAD` | `Enum` | A question item that lets the respondent upload a file. |\n| `UNSUPPORTED` | `Enum` | An item that is currently not supported through APIs. |"]]