Enum PageNavigationType
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
頁面導覽類型列舉代表支援的網頁導覽類型。您可以透過 FormApp.PageNavigationType
存取頁面導覽類型。
只有在受訪者選擇該選項時,系統才會在受訪者完成含有該選項的頁面後,進行頁面導覽。如果受訪者在同一頁面上選擇多個選項,且有頁面導覽操作說明,則只有最後一個導覽選項會生效。頁面導覽對表單的最後一個頁面也沒有任何影響。
使用頁面導覽的選項,無法與不使用頁面導覽的選項,在同一項中合併使用。
如要呼叫列舉,請呼叫其父項類別、名稱和屬性。例如
FormApp.PageNavigationType.CONTINUE
。
// Create a form and add a new multiple-choice item and a page-break item.
const form = FormApp.create('Form Name');
const item = form.addMultipleChoiceItem();
const pageBreak = form.addPageBreakItem();
// Set some choices with go-to-page logic.
const rightChoice = item.createChoice(
'Vanilla',
FormApp.PageNavigationType.SUBMIT,
);
const wrongChoice = item.createChoice(
'Chocolate',
FormApp.PageNavigationType.RESTART,
);
// For GO_TO_PAGE, just pass in the page break item. For CONTINUE (normally the
// default), pass in CONTINUE explicitly because page navigation cannot be mixed
// with non-navigation choices.
const iffyChoice = item.createChoice('Peanut', pageBreak);
const otherChoice = item.createChoice(
'Strawberry',
FormApp.PageNavigationType.CONTINUE,
);
item.setChoices([rightChoice, wrongChoice, iffyChoice, otherChoice]);
屬性
屬性 | 類型 | 說明 |
CONTINUE | Enum | 填寫完目前的頁面後,請繼續填寫表單的下一頁。 |
GO_TO_PAGE | Enum | 在完成目前頁面後,跳至表單的指定頁面。 |
RESTART | Enum | 在完成目前頁面後,從一開始重新開始填寫表單,但不要清除先前輸入的答案。 |
SUBMIT | Enum | 填妥目前頁面後,提交表單回覆。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003ePageNavigationType\u003c/code\u003e enables directing respondents to different pages or actions based on their choices in Google Forms.\u003c/p\u003e\n"],["\u003cp\u003eNavigation options include continuing to the next page, jumping to a specific page, restarting the form, or submitting the form.\u003c/p\u003e\n"],["\u003cp\u003eChoices with page navigation cannot be mixed with choices without navigation within the same form item.\u003c/p\u003e\n"],["\u003cp\u003eOnly the last navigation option selected on a page will be applied.\u003c/p\u003e\n"],["\u003cp\u003ePage navigation is ineffective on the last page of a form.\u003c/p\u003e\n"]]],[],null,["# Enum PageNavigationType\n\nPageNavigationType\n\nAn enum representing the supported types of page navigation. Page navigation types can be\naccessed from [FormApp.PageNavigationType](/apps-script/reference/forms/form-app#PageNavigationType).\n\nThe page navigation occurs after the respondent completes a page that contains the option, and\nonly if the respondent chose that option. If the respondent chose multiple options with\npage-navigation instructions on the same page, only the last navigation option has any effect.\nPage navigation also has no effect on the last page of a form.\n\nChoices that use page navigation cannot be combined in the same item with choices that do not\nuse page navigation.\n\nTo call an enum, you call its parent class, name, and property. For example, `\nFormApp.PageNavigationType.CONTINUE`.\n\n```javascript\n// Create a form and add a new multiple-choice item and a page-break item.\nconst form = FormApp.create('Form Name');\nconst item = form.addMultipleChoiceItem();\nconst pageBreak = form.addPageBreakItem();\n\n// Set some choices with go-to-page logic.\nconst rightChoice = item.createChoice(\n 'Vanilla',\n FormApp.PageNavigationType.SUBMIT,\n);\nconst wrongChoice = item.createChoice(\n 'Chocolate',\n FormApp.PageNavigationType.RESTART,\n);\n\n// For GO_TO_PAGE, just pass in the page break item. For CONTINUE (normally the\n// default), pass in CONTINUE explicitly because page navigation cannot be mixed\n// with non-navigation choices.\nconst iffyChoice = item.createChoice('Peanut', pageBreak);\nconst otherChoice = item.createChoice(\n 'Strawberry',\n FormApp.PageNavigationType.CONTINUE,\n);\nitem.setChoices([rightChoice, wrongChoice, iffyChoice, otherChoice]);\n``` \n\n### Properties\n\n| Property | Type | Description |\n|--------------|--------|------------------------------------------------------------------------------------------------------------------|\n| `CONTINUE` | `Enum` | Continue to the next page of the form after completing the current page. |\n| `GO_TO_PAGE` | `Enum` | Jump to a specified page of the form after completing the current page. |\n| `RESTART` | `Enum` | Restart the form from the beginning, without clearing answers entered so far, after completing the current page. |\n| `SUBMIT` | `Enum` | Submit the form response after completing the current page. |"]]