Class CheckboxGridValidation
Case à cocherGrilleValidation
Une validation des données pour un CheckboxGridItem
.
// Add a checkbox grid item to a form and require one response per column.
const form = FormApp.openById('123abc');
const checkboxGridItem = form.addCheckboxGridItem();
checkboxGridItem.setTitle('Where did you celebrate New Years?')
.setRows(['New York', 'San Francisco', 'London'])
.setColumns(['2014', '2015', '2016', '2017']);
const checkboxGridValidation = FormApp.createCheckboxGridValidation()
.setHelpText('Select one item per column.')
.requireLimitOneResponsePerColumn()
.build();
checkboxGridItem.setValidation(checkboxGridValidation);
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2024/12/22 (UTC).
[null,null,["Dernière mise à jour le 2024/12/22 (UTC)."],[[["`CheckboxGridValidation` is used to set validation rules specifically for `CheckboxGridItem` within Google Forms."],["It allows you to enforce constraints like requiring exactly one response per column in a checkbox grid, enhancing data integrity and user experience."],["You can customize the validation with help text to guide users on expected input."]]],["This content demonstrates creating and validating a checkbox grid item within a form. It outlines adding a checkbox grid with titles, rows (e.g., \"New York\"), and columns (e.g., \"2014\"). The example then builds a `CheckboxGridValidation` to enforce a limit of one response per column, including setting custom help text. Finally, it applies this validation to the checkbox grid, ensuring responses adhere to the set criteria.\n"]]