Javascript 如何在客户端的表单视图中使用Google表单

Javascript 如何在客户端的表单视图中使用Google表单,javascript,google-apps-script,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)

如果在打开表单编辑器时运行该代码,则该代码工作正常:

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.');
      }
但是它在表单视图上不起作用,当有人填充它时,我不明白谷歌为什么这样做,我看到对话框而不是填充对话框有什么好处。。。 另外,我是否可以在提交表单之前获得响应,以便使用javascript函数验证某个字段


或者,如何在谷歌表单应用程序脚本上实现这些功能?

谷歌应用程序脚本仅在谷歌表单编辑器上运行,而不在表单视图上运行

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