简体   繁体   English

网格项的 Google 表单 Google Apps 脚本答案验证

[英]Google Form Google Apps Script answer validation for grid item

If i create a question in a grid form say.. qn: "if price increase by the following amount, will you still buy?"如果我以网格形式创建一个问题,请说.. qn:“如果价格上涨以下金额,您还会购买吗?” options: 5% Yes No (choose either yes or no) 10% Yes No (choose either yes or no) 15% Yes No (choose either yes or no)选项:5% 是 否(选择是或否) 10% 是否(选择是或否) 15% 是否(选择是或否)

and i want to create an answer validation such that if a user choose "No" for 5% and choose "Yes" for 10% and 15%, it will have an error message that say ("logical error")并且我想创建一个答案验证,以便如果用户为 5% 选择“否”并为 10% 和 15% 选择“是”,它将显示一条错误消息(“逻辑错误”)

What would be the right code to use?要使用的正确代码是什么?

At the moment, there is no way of implementing this sort of validations using Forms.目前,无法使用 Forms 实现此类验证。 The only options you have is:你唯一的选择是:

  1. Explaining your restrictions on your form, and using an onFormSubmit event to filter out responses that do not match your criteria.解释您对表单的限制,并使用onFormSubmit事件过滤掉与您的条件不匹配的响应。 Using this option however, the user is still able to submit the form and will not receive any feedback telling him his submission is not correct.但是,使用此选项,用户仍然可以提交表单并且不会收到任何反馈,告诉他他的提交不正确。

  2. Using a WebApp .使用WebApp The idea of this one is to implement a basic form using HTML.这个想法是使用 HTML 实现一个基本的表单 The restrictions you described could then be verified using Javascript, and the results can be published into a Google Sheets document of your choice.然后可以使用 Javascript 验证您描述的限制,并且可以将结果发布到您选择的 Google 表格文档中。 This option however, will clearly take more effort.然而,这个选项显然需要更多的努力。 You can see an example of creating a form using WebApps here .您可以在此处查看使用 WebApps 创建表单的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM