Class CheckboxValidationBuilder  |  Apps Script  |  Google for Developers (original) (raw)

Class CheckboxValidationBuilder

Stay organized with collections Save and categorize content based on your preferences.

CheckboxValidationBuilder

A DataValidationBuilder for a [CheckboxValidation](/apps-script/reference/forms/checkbox-validation).

// Add a checkBox item to a form and require exactly two selections. const form = FormApp.create('My Form'); const checkBoxItem = form.addCheckboxItem(); checkBoxItem.setTitle('What two condiments would you like on your hot dog?'); checkBoxItem.setChoices([ checkBoxItem.createChoice('Ketchup'), checkBoxItem.createChoice('Mustard'), checkBoxItem.createChoice('Relish'), ]); const checkBoxValidation = FormApp.createCheckboxValidation() .setHelpText('Select two condiments.') .requireSelectExactly(2) .build(); checkBoxItem.setValidation(checkBoxValidation);

Detailed documentation

requireSelectAtLeast(number)


requireSelectAtMost(number)


requireSelectExactly(number)

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.