如何防止表单提交,直到以前onFormSubmit完成。 [英] How can I prevent form submissions until previous onFormSubmit is finished.
本文介绍了如何防止表单提交,直到以前onFormSubmit完成。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我写了一个表单脚本,消除了所选的答案。这意味着它必须处理onFormSubmit函数。当脚本正常工作时,最终用户必须等待30秒,然后再单击重新提交,否则选择将不会被消除。
I have written a form script that eliminates the chosen answer. This means it has to process a function onFormSubmit. While the script works, the end-user has to wait 30 seconds before they click resubmit or else the choice will not be eliminated.
有没有办法阻止提交直到onFormSubmit函数完成?
Is there a way I can prevent submissions until the onFormSubmit function is completed?
推荐答案
我能够使用setAcceptingResponses(enabled)完成此操作(谢谢AdamL)。
I was able to accomplish this (thank you AdamL) using setAcceptingResponses(enabled).
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);
}
这篇关于如何防止表单提交,直到以前onFormSubmit完成。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文