Log in

View Full Version : Redirect a Google Docs form to your custom 'thank you' page



Rain Lover
10-11-2012, 03:56 PM
Here's a Google Docs form:


<form action="https://docs.google.com/spreadsheet/formResponse?formkey=dE02TlBHQ2hnVVdkTE5ya0lBYXhaMlE6MQ&amp;ifq" method="POST" id="ss-form">
<br>
<div class="errorbox-good">
<div class="ss-item ss-item-required ss-text"><div class="ss-form-entry"><label class="ss-q-title" for="entry_0">First name
<span class="ss-required-asterisk">*</span></label>
<label class="ss-q-help" for="entry_0"></label>
<input type="text" name="entry.0.single" value="" class="ss-q-short" id="entry_0"></div></div></div>
<br> <div class="errorbox-good">
<div class="ss-item ss-item-required ss-text"><div class="ss-form-entry"><label class="ss-q-title" for="entry_1">Last name
<span class="ss-required-asterisk">*</span></label>
<label class="ss-q-help" for="entry_1"></label>
<input type="text" name="entry.1.single" value="" class="ss-q-short" id="entry_1"></div></div></div>
<br>
<input type="hidden" name="pageNumber" value="0">
<input type="hidden" name="backupCache" value="">
<div class="ss-item ss-navigate"><div class="ss-form-entry">
<input type="submit" name="submit" value="Submit"></div></div></form>

And here's the spreadsheet that it feeds:
https://docs.google.com/spreadsheet/ccc?key=0ApjOXzxlxbMhdE02TlBHQ2hnVVdkTE5ya0lBYXhaMlE

I wonder how to redirect the form to my own custom 'thank you' page on submission.
Thanks!

bernie1227
10-11-2012, 11:35 PM
All you have to do is change the form action, so:


<form action="your-page.php" method="POST" id="ss-form">

Rain Lover
10-12-2012, 02:18 AM
All you have to do is change the form action, so:


<form action="your-page.php" method="POST" id="ss-form">


Thanks for the answer, but it prevents the Google form to send the information to the spreadsheet.

bernie1227
10-12-2012, 02:32 AM
oh right sorry, try something like:


<script type="text/javascript">var submitted=false;</script>
<iframe id="redirect" style="display:none;" onload="if(submitted) {window.location='your redirect';}"></iframe>
<form action="https://docs.google.com/spreadsheet/formResponse?formkey=dE02TlBHQ2hnVVdkTE5ya0lBYXhaMlE6MQ&amp;ifq" method="post" target="redirect" onsubmit="submitted=true;">

Rain Lover
10-13-2012, 09:25 AM
oh right sorry, try something like:


<script type="text/javascript">var submitted=false;</script>
<iframe id="redirect" style="display:none;" onload="if(submitted) {window.location='your redirect';}"></iframe>
<form action="https://docs.google.com/spreadsheet/formResponse?formkey=dE02TlBHQ2hnVVdkTE5ya0lBYXhaMlE6MQ&ifq" method="post" target="redirect" onsubmit="submitted=true;">


Seems to be working, but there should be a more straightforward approach to such a simple problem.
Thanks anyway!

bernie1227
10-13-2012, 09:27 AM
That's fine,

If the thread is finished, please set it to resolved by clicking edit, advanced options and then change prefix