Class ParagraphTextValidationBuilder
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Criadordevalidaçãodeparágrafos
Um DataValidationBuilder para um ParagraphTextValidation
.
// 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);
Documentação detalhada
requireTextContainsPattern(pattern)
A resposta precisa conter o padrão.
Parâmetros
Nome | Tipo | Descrição |
pattern | String | o texto precisa conter um padrão |
Retornar
ParagraphTextValidationBuilder
: este para encadeamento
requireTextDoesNotContainPattern(pattern)
Requer que a resposta não contenha padrão.
Parâmetros
Nome | Tipo | Descrição |
pattern | String | O texto não pode conter padrões |
Retornar
ParagraphTextValidationBuilder
: este para encadeamento
requireTextDoesNotMatchPattern(pattern)
Requer que a resposta não corresponda ao padrão.
Parâmetros
Nome | Tipo | Descrição |
pattern | String | O texto não pode corresponder ao padrão |
Retornar
ParagraphTextValidationBuilder
: este para encadeamento
requireTextLengthGreaterThanOrEqualTo(number)
Requer que o comprimento da resposta seja maior ou igual ao valor.
Parâmetros
Nome | Tipo | Descrição |
number | Integer | O comprimento do texto do parágrafo precisa ser maior que este valor |
Retornar
ParagraphTextValidationBuilder
: este para encadeamento
requireTextLengthLessThanOrEqualTo(number)
Requer que o tamanho da resposta seja menor que o valor.
Parâmetros
Nome | Tipo | Descrição |
number | Integer | O comprimento do texto do parágrafo precisa ser menor ou igual a este valor |
Retornar
ParagraphTextValidationBuilder
: este para encadeamento
requireTextMatchesPattern(pattern)
A resposta precisa corresponder ao padrão.
Parâmetros
Nome | Tipo | Descrição |
pattern | String | O texto precisa corresponder ao padrão |
Retornar
ParagraphTextValidationBuilder
: este para encadeamento
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-07-26 UTC.
[null,null,["Última atualização 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eParagraphTextValidationBuilder\u003c/code\u003e lets you set validation rules for paragraph text responses in Google Forms.\u003c/p\u003e\n"],["\u003cp\u003eYou can enforce rules like minimum/maximum text length, and require or exclude specific patterns in the text.\u003c/p\u003e\n"],["\u003cp\u003eAll validation methods return the \u003ccode\u003eParagraphTextValidationBuilder\u003c/code\u003e object itself, enabling method chaining for concise code.\u003c/p\u003e\n"],["\u003cp\u003eUse this class with \u003ccode\u003eFormApp.createParagraphTextValidation()\u003c/code\u003e to define the validation for a paragraph text item.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the detailed documentation and method table for specifics on each validation rule and its parameters.\u003c/p\u003e\n"]]],[],null,["# Class ParagraphTextValidationBuilder\n\nParagraphTextValidationBuilder\n\nA DataValidationBuilder for a [ParagraphTextValidation](/apps-script/reference/forms/paragraph-text-validation).\n\n```javascript\n// Add a paragraph text item to a form and require the answer to be at least 100\n// characters.\nconst form = FormApp.create('My Form');\nconst paragraphTextItem =\n form.addParagraphTextItem().setTitle('Describe yourself:');\nconst paragraphtextValidation =\n FormApp.createParagraphTextValidation()\n .setHelpText('Answer must be more than 100 characters.')\n .requireTextLengthGreaterThan(100);\nparagraphTextItem.setValidation(paragraphtextValidation);\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|--------------------------------------------------------------------------------------------------|-------------------------------------|----------------------------------------------------------------|\n| [requireTextContainsPattern(pattern)](#requireTextContainsPattern(String)) | [ParagraphTextValidationBuilder](#) | Requires response to contain pattern. |\n| [requireTextDoesNotContainPattern(pattern)](#requireTextDoesNotContainPattern(String)) | [ParagraphTextValidationBuilder](#) | Requires response to not contain pattern. |\n| [requireTextDoesNotMatchPattern(pattern)](#requireTextDoesNotMatchPattern(String)) | [ParagraphTextValidationBuilder](#) | Requires response to not match pattern. |\n| [requireTextLengthGreaterThanOrEqualTo(number)](#requireTextLengthGreaterThanOrEqualTo(Integer)) | [ParagraphTextValidationBuilder](#) | Requires response length to be greater than or equal to value. |\n| [requireTextLengthLessThanOrEqualTo(number)](#requireTextLengthLessThanOrEqualTo(Integer)) | [ParagraphTextValidationBuilder](#) | Requires response length to be less than value. |\n| [requireTextMatchesPattern(pattern)](#requireTextMatchesPattern(String)) | [ParagraphTextValidationBuilder](#) | Requires response to match pattern. |\n\nDetailed documentation\n----------------------\n\n### `require``Text``Contains``Pattern(pattern)`\n\nRequires response to contain pattern.\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------|----------|---------------------------|\n| `pattern` | `String` | text must contain pattern |\n\n#### Return\n\n\n[ParagraphTextValidationBuilder](#) --- this for chaining\n\n*** ** * ** ***\n\n### `require``Text``Does``Not``Contain``Pattern(pattern)`\n\nRequires response to not contain pattern.\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------|----------|-------------------------------|\n| `pattern` | `String` | text must not contain pattern |\n\n#### Return\n\n\n[ParagraphTextValidationBuilder](#) --- this for chaining\n\n*** ** * ** ***\n\n### `require``Text``Does``Not``Match``Pattern(pattern)`\n\nRequires response to not match pattern.\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------|----------|-----------------------------|\n| `pattern` | `String` | text must not match pattern |\n\n#### Return\n\n\n[ParagraphTextValidationBuilder](#) --- this for chaining\n\n*** ** * ** ***\n\n### `require``Text``Length``Greater``Than``Or``Equal``To(number)`\n\nRequires response length to be greater than or equal to value.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|-----------|-------------------------------------------------------|\n| `number` | `Integer` | paragraph text length must be greater than this value |\n\n#### Return\n\n\n[ParagraphTextValidationBuilder](#) --- this for chaining\n\n*** ** * ** ***\n\n### `require``Text``Length``Less``Than``Or``Equal``To(number)`\n\nRequires response length to be less than value.\n\n#### Parameters\n\n| Name | Type | Description |\n|----------|-----------|----------------------------------------------------------------|\n| `number` | `Integer` | paragraph text length must be less than or equal to this value |\n\n#### Return\n\n\n[ParagraphTextValidationBuilder](#) --- this for chaining\n\n*** ** * ** ***\n\n### `require``Text``Matches``Pattern(pattern)`\n\nRequires response to match pattern.\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------|----------|-------------------------|\n| `pattern` | `String` | text must match pattern |\n\n#### Return\n\n\n[ParagraphTextValidationBuilder](#) --- this for chaining"]]