Class CheckboxValidationBuilder

Checkbox Validation Builder

A DataValidationBuilder for a 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 
 ); 

Methods

Method Return type Brief description
Checkbox Validation Builder Require at least this many choices to be selected.
Checkbox Validation Builder Require at most this many choices to be selected.
Checkbox Validation Builder Require exactly this many choices to be selected.

Detailed documentation

require Select At Least(number)

Require at least this many choices to be selected.

Parameters

Name Type Description
number
Integer

Return

Checkbox Validation Builder — this Checkbox Validation Builder , for chaining


require Select At Most(number)

Require at most this many choices to be selected.

Parameters

Name Type Description
number
Integer

Return

Checkbox Validation Builder — this Checkbox Validation Builder , for chaining


require Select Exactly(number)

Require exactly this many choices to be selected.

Parameters

Name Type Description
number
Integer

Return

Checkbox Validation Builder — this Checkbox Validation Builder , for chaining

Create a Mobile Website
View Site in Mobile | Classic
Share by: