How do I manipulate with Google Forms on Form View

2019-09-14 18:20发布

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

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?

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

1条回答
别忘想泡老子
2楼-- · 2019-09-14 18:44

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

Similar answers by other members to similar questions:

查看更多
登录 后发表回答