Enum PageNavigationType
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
PageNavigationType
Một enum đại diện cho các loại thao tác điều hướng trang được hỗ trợ. Bạn có thể truy cập vào các loại điều hướng trang từ FormApp.PageNavigationType
.
Thao tác di chuyển trang sẽ diễn ra sau khi người trả lời hoàn tất một trang chứa tuỳ chọn và chỉ khi người trả lời chọn tuỳ chọn đó. Nếu người trả lời chọn nhiều lựa chọn có hướng dẫn điều hướng trang trên cùng một trang, thì chỉ lựa chọn điều hướng gần đây nhất mới có hiệu lực.
Thao tác điều hướng trang cũng không ảnh hưởng đến trang cuối cùng của biểu mẫu.
Bạn không thể kết hợp các lựa chọn sử dụng tính năng điều hướng trang trong cùng một mục với các lựa chọn không sử dụng tính năng điều hướng trang.
Để gọi một enum, bạn gọi lớp mẹ, tên và thuộc tính của enum đó. Ví dụ:
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]);
Thuộc tính
Thuộc tính | Loại | Mô tả |
CONTINUE | Enum | Tiếp tục chuyển sang trang tiếp theo của biểu mẫu sau khi hoàn tất trang hiện tại. |
GO_TO_PAGE | Enum | Chuyển đến một trang cụ thể của biểu mẫu sau khi hoàn tất trang hiện tại. |
RESTART | Enum | Khởi động lại biểu mẫu từ đầu, mà không xoá các câu trả lời đã nhập cho đến thời điểm này, sau khi hoàn tất trang hiện tại. |
SUBMIT | Enum | Gửi nội dung phản hồi của biểu mẫu sau khi hoàn tất trang hiện tại. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\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. |"]]