DataValidationBuilder สำหรับ CheckboxValidation
// 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);
เมธอด
| วิธีการ | ประเภทการแสดงผล | รายละเอียดแบบย่อ |
|---|---|---|
require | Checkbox | กำหนดให้เลือกตัวเลือกอย่างน้อยเท่านี้ |
require | Checkbox | ต้องเลือกตัวเลือกอย่างน้อยเท่านี้ |
require | Checkbox | กำหนดให้เลือกตัวเลือกจำนวนเท่านี้เท่านั้น |
เอกสารโดยละเอียด
requireSelectAtLeast(number)
กำหนดให้เลือกตัวเลือกอย่างน้อยเท่านี้
พารามิเตอร์
| ชื่อ | ประเภท | คำอธิบาย |
|---|---|---|
number | Integer |
รีเทิร์น
CheckboxValidationBuilder — CheckboxValidationBuilder นี้สำหรับการเชื่อมโยง
requireSelectAtMost(number)
ต้องเลือกตัวเลือกอย่างน้อยเท่านี้
พารามิเตอร์
| ชื่อ | ประเภท | คำอธิบาย |
|---|---|---|
number | Integer |
รีเทิร์น
CheckboxValidationBuilder — CheckboxValidationBuilder นี้สำหรับการเชื่อมโยง
requireSelectExactly(number)
กำหนดให้เลือกตัวเลือกจำนวนเท่านี้เท่านั้น
พารามิเตอร์
| ชื่อ | ประเภท | คำอธิบาย |
|---|---|---|
number | Integer |
รีเทิร์น
CheckboxValidationBuilder — CheckboxValidationBuilder นี้สำหรับการเชื่อมโยง