Class ParagraphTextValidation

  • ParagraphTextValidation is a DataValidation specifically for a ParagraphTextItem in Google Forms.

  • It allows you to set validation rules, such as requiring a minimum text length.

  • The example demonstrates how to create a form, add a paragraph text item, set a validation requiring at least 100 characters, and assign the validation to the item.

ParagraphTextValidation

A DataValidation for a ParagraphTextItem .

// Add a paragraph text item to a form and require the answer to be at least 100
// characters.
constform=FormApp.create('My Form');
constparagraphTextItem=
form.addParagraphTextItem().setTitle('Describe yourself:');
constparagraphtextValidation=
FormApp.createParagraphTextValidation()
.setHelpText('Answer must be more than 100 characters.')
.requireTextLengthGreaterThanOrEqualTo(100)
.build();
paragraphTextItem.setValidation(paragraphtextValidation);

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024年12月02日 UTC.