如何在客户端Form View上使用Google Forms进行操作 [英] How do I manipulate with Google Forms on Form View, client side

查看:93
本文介绍了如何在客户端Form View上使用Google Forms进行操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在打开表单编辑器"时运行此代码,效果很好:

This code works just fine if I run it when Form Editor is opened:

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.');
      }

但是它在窗体视图上不起作用,当有人填充它时,我不明白Google为什么以这种方式使它起作用,我看到该对话框而不是一个对话框有什么好处... 另外,是否有可能在提交表单之前得到响应,以便可以通过使用一些javascript函数来验证某些字段?

But it does not work on the Form View, when someone filling it, I dont understand why google made it work this way, what is the benefit of me seeing the dialog box and not the one filling it... Also, is it possible that I can get the response before the form is being submited so I can validate certain field by using some javascript function?

或者我该如何在Google Forms应用脚本上实现这些目的?

Alternatively how can I achieve such things on Google Forms apps script?

推荐答案

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

Google Apps Script only runs on the Google Form editor, not on the Form View.

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

Similar answers by other members to similar questions:

  • https://stackoverflow.com/a/26627257/1595451
  • https://stackoverflow.com/a/18649165/1595451

这篇关于如何在客户端Form View上使用Google Forms进行操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆