googleworkspace / googleworkspace/apps-script-samples

Cannot retrieve validation rules for checkbox items in Google Forms API

Open
#562 0 comments 0 reactions 1 assignee View on GitHub

@PierrickVoulet is already working on this.

Since Sep 22, 2025.

Dominant language
JavaScript
Stars
5.2k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.