Class CheckboxValidation
ValidasiKotak Centang
DataValidation untuk CheckboxItem
.
// 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);
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2024-12-02 UTC.
[null,null,["Terakhir diperbarui pada 2024-12-02 UTC."],[[["`CheckboxValidation` is used to set validation rules specifically for checkbox items within Google Forms."],["It allows you to define requirements like the number of choices a user must select using methods like `requireSelectExactly()`."],["A help text can be associated with the validation to guide the user using `setHelpText()`."]]],[]]