// Add a checkBox item to a form and require exactly two selections.constform=FormApp.create('My Form');constcheckBoxItem=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'),]);constcheckBoxValidation=FormApp.createCheckboxValidation().setHelpText('Select two condiments.').requireSelectExactly(2).build();checkBoxItem.setValidation(checkBoxValidation);
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-26 UTC。"],[[["\u003cp\u003e\u003ccode\u003eCheckboxValidationBuilder\u003c/code\u003e allows you to set validation rules for checkbox items in Google Forms.\u003c/p\u003e\n"],["\u003cp\u003eYou can specify the minimum, maximum, or exact number of choices that must be selected.\u003c/p\u003e\n"],["\u003cp\u003eValidation rules can be customized with help text to guide users.\u003c/p\u003e\n"],["\u003cp\u003eIt is used with \u003ccode\u003eCheckboxItem\u003c/code\u003e to create and manage checkbox questions within forms.\u003c/p\u003e\n"]]],[],null,["CheckboxValidationBuilder\n\nA DataValidationBuilder for a [CheckboxValidation](/apps-script/reference/forms/checkbox-validation).\n\n```javascript\n// Add a checkBox item to a form and require exactly two selections.\nconst form = FormApp.create('My Form');\nconst checkBoxItem = form.addCheckboxItem();\ncheckBoxItem.setTitle('What two condiments would you like on your hot dog?');\ncheckBoxItem.setChoices([\n checkBoxItem.createChoice('Ketchup'),\n checkBoxItem.createChoice('Mustard'),\n checkBoxItem.createChoice('Relish'),\n]);\nconst checkBoxValidation = FormApp.createCheckboxValidation()\n .setHelpText('Select two condiments.')\n .requireSelectExactly(2)\n .build();\ncheckBoxItem.setValidation(checkBoxValidation);\n``` \n\nMethods\n\n| Method | Return type | Brief description |\n|----------------------------------------------------------------|--------------------------------|----------------------------------------------------|\n| [requireSelectAtLeast(number)](#requireSelectAtLeast(Integer)) | [CheckboxValidationBuilder](#) | Require at least this many choices to be selected. |\n| [requireSelectAtMost(number)](#requireSelectAtMost(Integer)) | [CheckboxValidationBuilder](#) | Require at most this many choices to be selected. |\n| [requireSelectExactly(number)](#requireSelectExactly(Integer)) | [CheckboxValidationBuilder](#) | Require exactly this many choices to be selected. |\n\nDetailed documentation \n\n`require``Select``At``Least(number)` \nRequire at least this many choices to be selected.\n\nParameters\n\n| Name | Type | Description |\n|----------|-----------|-------------|\n| `number` | `Integer` | |\n\nReturn\n\n\n[CheckboxValidationBuilder](#) --- this [CheckboxValidationBuilder](#), for chaining\n\n*** ** * ** ***\n\n`require``Select``At``Most(number)` \nRequire at most this many choices to be selected.\n\nParameters\n\n| Name | Type | Description |\n|----------|-----------|-------------|\n| `number` | `Integer` | |\n\nReturn\n\n\n[CheckboxValidationBuilder](#) --- this [CheckboxValidationBuilder](#), for chaining\n\n*** ** * ** ***\n\n`require``Select``Exactly(number)` \nRequire exactly this many choices to be selected.\n\nParameters\n\n| Name | Type | Description |\n|----------|-----------|-------------|\n| `number` | `Integer` | |\n\nReturn\n\n\n[CheckboxValidationBuilder](#) --- this [CheckboxValidationBuilder](#), for chaining"]]