【问题标题】:How can I prevent form submissions until previous onFormSubmit is finished.如何在之前的 onFormSubmit 完成之前阻止表单提交。
【发布时间】:2014-09-20 00:31:58
【问题描述】:

我编写了一个表单脚本来消除所选答案。这意味着它必须处理一个函数 onFormSubmit。虽然脚本有效,但最终用户必须等待 30 秒才能单击重新提交,否则不会取消选择。

有没有办法在 onFormSubmit 函数完成之前阻止提交?

【问题讨论】:

  • 是的,它确实可以防止再次提交。谢谢

标签: google-apps-script


【解决方案1】:

我能够使用 setAcceptingResponses(enabled) 完成此操作(感谢 AdamL)。

function onFormSubmit(){
  var af = FormApp.getActiveForm();
  var defaultClosedFor = af.getCustomClosedFormMessage();
  af.setCustomClosedFormMessage("The form is currently processing a submission, please refresh the page.");
  af.setAcceptingResponses(false);


<put your script stuff here>


   af.setAcceptingResponses(true);
  af.setCustomClosedFormMessage(defaultClosedFor);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-05
    • 1970-01-01
    • 1970-01-01
    • 2014-08-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多