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 處理的項目。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間: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. |"]]