设置Google表单以刷新提交 [英] Setting a Google Form to refresh on submission

查看:165
本文介绍了设置Google表单以刷新提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在网站上以HTML格式保存Google表单.

Have google form on website in HTML.

我遇到的问题是,提交后,用户将被重定向到丑陋的确认页面.

The problem I have is that on submission the user is redirected to ugly confirmation page.

该表单旨在接收多个提交.

The form is designed to receive multiple submissions.

我的解决方案是在提交表单时刷新页面,从而允许发送条目并使页面为一键创建新页面做好准备.

My solution is to make page refresh when form is submitted, allowing the entry to be sent and having the page ready for a new one in one click.

但是我无法使它正常工作.

However I cannot get this to work.

我尝试将提交按钮包装在锚标记中

I've tried wrapping the submit button in anchor tag

<a href="javascript:history.go(0)"> 
   <button type="submit"> SUBMIT </button>
</a>

我尝试提供两个值来提交按钮

I've tried giving two values to submit button

<input type="button" class="sbutton" name="submit" type="submit"    
value="Submit" value="Refresh Page"
onClick="window.location.reload()"/>

我尝试不首先知道其名称就链接到该网页

I've tried to link to the webpage without first knowing its name

<a href="?"> 
   <button type="submit"> SUBMIT </button> 
</a>

如您所见,我迷路了.任何帮助,不胜感激.

As you can see, I'm lost. Any help much appreciated.

这是我用来提交表单的脚本,到目前为止,所有解决方案都无法完成我指定的操作,因为它们似乎与以下内容发生冲突:

Here is the script I'm using to submit the form, none of the solutions so far have been able to do what I specified, because they seem to clash in some way with the following:

<script>
$('#input-form').one('submit',function(){
    var inputq1 = encodeURIComponent($('#input-q1').val());
    var inputq2 = encodeURIComponent($('#input-q2').val());
    var inputq3 = encodeURIComponent($('#input-q3').val());
    var q1ID = "entry.340878806";
    var q2ID = "entry.569569223";
    var q3ID = "entry.1623478195";
    var baseURL = 'https://docs.google.com/forms/d/e/1FAIpQLSf6So7J-     dJum3X4_rWAn07yALmyirzHDvufr5Ke3FUTXuR5wA/formResponse?';
    var submitRef = '&submit=1480224357040003724';
    var submitURL = (baseURL + q1ID + "=" + inputq1 + "&" + q2ID + "=" + inputq2 + "&" + q3ID + "=" + inputq3 + submitRef);
    console.log(submitURL);
    $(this)[0].action=submitURL;
    $('#input-feedback').text('Word succesfully submitted, refresh page to submit a new one');
        });

推荐答案

我没有看到您的表单,我假设您正在尝试刷新页面以摆脱已提交的页面.为什么要首先将用户带到该页面?您可以执行以下操作:

Without seeing your form, I'm assuming that you're trying to refresh the page to get rid of the submitted page. Why take the user to that page in the first place? You can do that with the following:

onclick="SubmitForm(); return false;"

要在从提交的页面返回后清除表单,请在您的Submit函数中添加以下行:

To clear the form after returning from the submitted page, add the following line in your submit function:

function SubmitForm() {
   document.formName.reset(); 
}

这篇关于设置Google表单以刷新提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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