Class DataValidationBuilder

DataValidationBuilder

The base DataValidationBuilder that contains setters for properties common to all validations, such as help text. Used to build DataValadation objects.

 // Add a text item to a form and require it to be a number within a range.
 var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?');
 var textValidation = FormApp.createTextValidation()
   .setHelpText(“Input was not a number between 1 and 100.”)
   .requireNumberBetween(1, 100)
   .build();
 textItem.setValidation(textValidation);
 

Methods

MethodReturn typeBrief description
build()DataValidationBuilds a DataValidation of the corresponding type for this builder.
copy()DataValidationBuilderReturns a copy of this builder.
setHelpText(text)DataValidationBuilderSets the item's help text.

Detailed documentation

build()

Builds a DataValidation of the corresponding type for this builder.

Return

DataValidationDataValidation


copy()

Returns a copy of this builder.

Return

DataValidationBuilderDataValidationBuilder


setHelpText(text)

Sets the item's help text. This text is shown to the user if the input fails validation.

Parameters

NameTypeDescription
textStringthe new help text

Return

DataValidationBuilder — this DataValidation, for chaining

Send feedback about...

Apps Script
Apps Script
Need help? Visit our support page.