Skip to content

Cannot retrieve validation rules for checkbox items in Google Forms API #562

@suneox

Description

@suneox

Problem

Currently, Google Apps Script and Google Forms API do not provide a way to retrieve validation rules for checkbox items in Google Forms.

Current Behavior

When using FormApp.openById() and iterating through form items, checkbox items created with item.asCheckboxItem() do not expose any methods to access validation rules such as:

  • Minimum number of selections required
  • Maximum number of selections allowed
  • Custom validation messages

Expected Behavior

There should be methods available to retrieve validation rules for checkbox items, similar to how other form item types expose their validation settings.

Use Case

We need to programmatically read form structures including validation rules to:

  1. Display proper validation messages in custom form renderers
  2. Replicate form validation logic in external applications
  3. Generate form documentation that includes validation requirements

Code Example

function getFormData(formId) {
  var form = FormApp.openById(formId);
  var items = form.getItems();
  
  items.forEach(function(item) {
    if (item.getType() === FormApp.ItemType.CHECKBOX) {
      var checkboxItem = item.asCheckboxItem();
      
      // These methods don't exist but would be useful:
      // checkboxItem.getValidation()
      // checkboxItem.getMinSelections()
      // checkboxItem.getMaxSelections()
      // checkboxItem.getValidationHelpText()
    }
  });
}

Impact

This limitation prevents developers from creating comprehensive form processing tools and custom form UIs that need to respect the original form's validation rules.

Workaround

Currently, there is no known workaround to retrieve this information programmatically.

Environment

  • Google Apps Script
  • Google Forms API
  • FormApp service

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions