//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"]],["最后更新时间 (UTC):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"]]