Old Google Form redirect after submission

六眼飞鱼酱① 提交于 2019-11-26 22:21:58

问题


I am looking for a solution (code) how to redirect user to a custom thank you page (not default Google's) after submitting the form with Old Google Form.

<iframe name="hidden_iframe"
        id="hidden_iframe"
        style="display:none;"
        onload="if(submitted){window.location='http:/...yourthankyoupage.htm';}">
</iframe>
<form action="https://spreadsheets.google.com/formResponse?formkey=....."
      method="post"
      target="hidden_iframe"
      onsubmit="submitted=true;">

This code is not working. At least not for me. Any suggestions?


回答1:


is this a form that you've styled yourself? some good reading here: http://morning.am/tutorials/how-to-style-google-forms/

basically its... replace

<form action="YOUR-EMBEDDED-GOOGLE-SPREADSHEET-LINK" method="POST">

with

<script type="text/javascript">var submitted=false;</script>
    <iframe name="hidden_iframe" id="hidden_iframe" style="display:none;"     
onload="if(submitted) {window.location='whateveryourredirectis.html';}"></iframe>
      <form action="YOUR-EMBEDDED-GOOGLE-SPREADSHEET-LINK" method="post" target="hidden_iframe" 
onsubmit="submitted=true;">



回答2:


Sneaky Sheep version 2 can automatically generate the necessary html to embed the form in your website. It preserves the stylesheets of your form.

Or, if you're using the original version of Sneaky Sheep, make sure to append the proper domain name in the styles section to get the stylesheets.

For example, I had to change

<link href='/static/forms/client/css/1234-formview_ltr.css' type='text/css' rel='stylesheet'>

to

<link href='https://docs.google.com/static/forms/client/css/3904611051-formview_ltr.css' type='text/css' rel='stylesheet'>



回答3:


You could also consider other options. After putting countless hours on trying to crank Google Forms to suit my needs, I had to give up. I tried both the morning.am tutorial as advised in the first answer, and the code generator in the other one. In both cases, I copied the Google Forms code to my own web page but ended up breaking the Submit button. This is also commented by other users on Sneaky Sheep code generator.

Apparently Google Forms is not designed to provide any customized feedback for the person who filled in the form. You could have a static text or even link on the confirmation page, but in my use case, the content of the confirmation page depends on the user's input.

My current workaround is to ditch Google Forms entirely, and build the query form on my own. I'm using a bootstrap form generator, for example http://bootsnipp.com/forms. The downside is that I'll have to spend more time on tweaking the visual appearance of the form myself. I'll update this answer if a better solution comes around.



来源:https://stackoverflow.com/questions/6077054/old-google-form-redirect-after-submission

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!