如何在窗体视图(客户端)上使用Google窗体进行操作

时间:2017-04-07 08:37:06

标签: javascript google-apps-script

如果在打开表单编辑器时运行它,此代码可以正常工作:

var ui = FormApp.getUi();
      var response = ui.prompt('Getting to know you', 'May I know your name?', ui.ButtonSet.YES_NO);

      // Process the user's response.
      if (response.getSelectedButton() == ui.Button.YES) {
        Logger.log('The user\'s name is %s.', response.getResponseText());
      } else if (response.getSelectedButton() == ui.Button.NO) {
        Logger.log('The user didn\'t want to provide a name.');
      } else {
        Logger.log('The user clicked the close button in the dialog\'s title bar.');
      }

但它在Form View上不起作用,当有人填写它时,我不明白为什么谷歌让它以这种方式工作,看到对话框的好处是什么,而不是填充它的人... 另外,我可以在提交表单之前获得响应,这样我可以通过使用一些javascript函数来验证某些字段吗?

或者我如何在Google Forms应用程序脚本上实现此类功能?

1 个答案:

答案 0 :(得分:0)

Google Apps脚本仅在Google表单编辑器上运行,而不是在表单视图上运行。

其他成员对类似问题的类似答案: