基本 DataValidation,其中包含所有驗證項目的通用屬性,例如說明文字。您可以為特定 Form 項目新增驗證機制。
//Addatextitemtoaformandrequireittobeanumberwithinarange.vartextItem=form.addTextItem().setTitle('Pick a number between 1 and 100?');vartextValidation=FormApp.createTextValidation().setHelpText(“Inputwasnotanumberbetween1and100.”).requireNumberBetween(1,100);textItem.setValidation(textValidation);
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eDataValidation objects define requirements for user input in Google Forms, such as specific data types or value ranges.\u003c/p\u003e\n"],["\u003cp\u003eThese validations can be applied to form items like text fields to ensure data integrity and guide user responses.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetHelpText()\u003c/code\u003e retrieves the message displayed to the user when input fails validation, aiding in understanding errors.\u003c/p\u003e\n"]]],[],null,[]]