Class CheckboxGridValidationBuilder

  • CheckboxGridValidationBuilder is used to create validation rules for Checkbox Grid items in Google Forms.

  • The requireLimitOneResponsePerColumn() method is used to ensure that users select only one response per column in a Checkbox Grid item.

  • The example demonstrates how to add a Checkbox Grid item to a form and apply validation to limit responses per column.

CheckboxGridValidationBuilder

A DataValidationBuilder for a CheckboxGridValidation .

// Add a checkbox grid item to a form and restrict it to one response per
// column.
constform=FormApp.openById('123abc');
constcheckboxGridItem=form.addCheckboxGridItem();
checkboxGridItem.setTitle('Where did you celebrate New Years?')
.setRows(['New York','San Francisco','London'])
.setColumns(['2014','2015','2016','2017']);
constcheckboxGridValidation=FormApp.createcheckboxGridValidation()
.setHelpText('Select one item per column.')
.requireLimitOneResponsePerColumn()
.build();
checkboxGridItem.setValidation(checkboxGridValidation);

Methods

MethodReturn typeBrief description
requireLimitOneResponsePerColumn() CheckboxGridValidationBuilder Requires limit of one response per column for a grid item.

Detailed documentation

requireLimitOneResponsePerColumn()

Requires limit of one response per column for a grid item.

Return

CheckboxGridValidationBuilder — this validation builder, for chaining

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024年12月02日 UTC.