Class ParagraphTextValidationBuilder
段落文本验证构建器
ParagraphTextValidation
的 DataValidationBuilder。
// Add a paragraph text item to a form and require the answer to be at least 100
// characters.
const form = FormApp.create('My Form');
const paragraphTextItem =
form.addParagraphTextItem().setTitle('Describe yourself:');
const paragraphtextValidation =
FormApp.createParagraphTextValidation()
.setHelpText('Answer must be more than 100 characters.')
.requireTextLengthGreaterThan(100);
paragraphTextItem.setValidation(paragraphtextValidation);
详细文档
requireTextContainsPattern(pattern)
requireTextDoesNotContainPattern(pattern)
requireTextDoesNotMatchPattern(pattern)
requireTextLengthGreaterThanOrEqualTo(number)
requireTextLengthLessThanOrEqualTo(number)
requireTextMatchesPattern(pattern)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-12-22。
[null,null,["最后更新时间 (UTC):2024-12-22。"],[[["`ParagraphTextValidationBuilder` lets you set validation rules for paragraph text responses in Google Forms."],["You can enforce rules like minimum/maximum text length, and require or exclude specific patterns in the text."],["All validation methods return the `ParagraphTextValidationBuilder` object itself, enabling method chaining for concise code."],["Use this class with `FormApp.createParagraphTextValidation()` to define the validation for a paragraph text item."],["Refer to the detailed documentation and method table for specifics on each validation rule and its parameters."]]],[]]