Cannot retrieve validation rules for checkbox items in Google Forms API
@PierrickVoulet 已经在做这个了。
开始于 2025年9月22日。
评估
这个 Issue 还没有评估数据。
描述
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:
- Display proper validation messages in custom form renderers
- Replicate form validation logic in external applications
- 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
- 主要语言
- JavaScript
- 星标
- 5.2k
- 派生
- 2k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
googleworkspace/apps-script-samples 的其他 Issue
-
难度 5/5 一周以上 新手友好度 1/100
googleworkspace/apps-script-samples#659 · 1 条评论 · 1 个 reaction ·
-
Password reset未关闭
难度 5/5 一周以上 新手友好度 15/100
googleworkspace/apps-script-samples#654 · 2 个 reaction ·
-
cod gs未关闭
难度 5/5 一周以上 新手友好度 10/100
googleworkspace/apps-script-samples#651 · 1 个 reaction ·
-
tespogrome未关闭
难度 5/5 一周以上 新手友好度 1/100
googleworkspace/apps-script-samples#624 · 1 个 reaction ·
-
Get_order_manually.gs可能重新可做 @vinay-google 于 227 天前认领,目前没有进行中的 PR。 未关闭
googleworkspace/apps-script-samples#616 · 已指派 1 人 ·
查看 googleworkspace/apps-script-samples 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
curriculum documentation quality
难度 2/5 1-3 小时 新手友好度 78/100
githubnext/gh-aw-workshop#3897 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
agent/quality hive/hosted-available-lke648397-260827-5n31 quality testing
难度 2/5 1-3 小时 新手友好度 91/100
维护者通常 1 天内回复