//Addatextitemtoaformandrequireittobeanumberwithinarange.vartextItem=form.addTextItem().setTitle('Pick a number between 1 and 100?');vartextValidation=FormApp.createTextValidation().setHelpText(“Inputwasnotanumberbetween1and100.”).requireNumberBetween(1,100).build();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"]],["上次更新時間:2024-12-22 (世界標準時間)。"],[[["`DataValidationBuilder` facilitates the creation of data validation rules for form items, like ensuring a text input is a number within a specific range."],["It provides methods to set help text, which is displayed if validation fails, and ultimately builds a `DataValidation` object applied to the form item."],["Developers can utilize methods such as `requireNumberBetween()` to define specific validation criteria, and chain methods for streamlined implementation."],["The `build()` method finalizes the validation setup, generating a `DataValidation` object ready to be associated with a form item for enforcing data integrity."]]],["`DataValidationBuilder` constructs `DataValidation` objects, allowing the setting of common validation properties like help text. The `build()` method finalizes the `DataValidation` object. `copy()` duplicates the builder. `setHelpText(text)` assigns instructional text displayed when input is invalid. As illustrated, a text item can be set to only accept numbers within a defined range, displaying help text for incorrect input. This process creates validations in forms.\n"]]