基本 DataValidation 包含所有驗證通用的屬性,例如說明文字。您可以針對特定 Form 項目新增驗證。
// 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);
textItem.setValidation(textValidation);