Skip to content

Instantly share code, notes, and snippets.

@chrislkeller
Created October 18, 2013 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save chrislkeller/7046946 to your computer and use it in GitHub Desktop.
Save chrislkeller/7046946 to your computer and use it in GitHub Desktop.
Example of re-directing a google from away from boilerplate submission page...
<!-- begin form container -->
<div class="ss-form">
<script type="text/javascript">var submitted=false;</script>
<iframe name="hidden_iframe" id="hidden_iframe" style="display:none;" onload="if(submitted) {window.location='***THIS IS THE URL OF THE PAGE TO REDIRECT'; alert('Thank you for your submission. We\'re manually updating submissions and will be adding yours soon.');}"></iframe>
<!-- begin form -->
<form action="***THIS IS THE URL FROM THE LIVE FORM USED TO POST TO" method="POST" target="hidden_iframe" id="commentForm" onsubmit="submitted=true;">
<div class="errorbox-good">
<div dir="ltr" class="ss-item ss-text">
<div class="ss-form-entry">
<label class="ss-q-title" for="entry_1">
<div class="ss-q-title"><strong>What&#39;s your name? *</strong></div>
</label>
<input type="text" name="entry.204984923" value="" class="ss-q-short">
</div>
</div>
</div>
<div class="errorbox-good">
<div dir="ltr" class="ss-item ss-text">
<div class="ss-form-entry">
<label class="ss-q-item-label">
<div class="ss-q-title"><strong>Are you a pedestrian or a cyclist? *</strong></div>
</label>
<label class="ss-q-item-label" for="entry_1813095312">You can select both</label>
<ul class="ss-choices ss-choices-required">
<li class="ss-choice-item"><label><span class="ss-choice-item-control goog-inline-block"><input type="checkbox" name="entry.1920812364" value="Pedestrian" id="group_1920812364_1" class="ss-q-checkbox"></span><span class="ss-choice-label">Pedestrian</span></label></li>
<li class="ss-choice-item"><label><span class="ss-choice-item-control goog-inline-block"><input type="checkbox" name="entry.1920812364" value="Cyclist" id="group_1920812364_2" class="ss-q-checkbox"></span><span class="ss-choice-label">Cyclist</span></label></li>
<li class="ss-choice-item"><label><span class="ss-choice-item-control goog-inline-block"><input type="checkbox" name="entry.1920812364" value="Both" id="group_1920812364_3" class="ss-q-checkbox"></span><span class="ss-choice-label">Both</span></label></li>
</ul>
</div>
</div>
</div>
<div class="errorbox-good">
<div dir="ltr" class="ss-item ss-text">
<div class="ss-form-entry">
<label class="ss-q-item-label">
<div class="ss-q-title"><strong>Which intersection or address is dangerous? *</strong></div>
</label>
<label class="ss-q-help">Be as specific as possible, please.</label>
<input type="text" name="entry.1401202234" id="entry_1401202234">
</div>
</div>
</div>
<div class="errorbox-good">
<div dir="ltr" class="ss-item ss-paragraph-text">
<div class="ss-form-entry">
<label class="ss-q-item-label">
<div class="ss-q-title"><strong>Tell us, in short, what the issue is there or your story. *</strong></div>
</label>
<textarea name="entry.453870666" rows="8" cols="95" class="input-large ss-q-long" id="entry_453870666" dir="auto"></textarea>
</div>
</div>
<p class="data-instructions"><em>* Required.</em></p>
</div>
<input type="hidden" name="draftResponse" value="[]">
<input type="hidden" name="pageHistory" value="0">
<div class="ss-form-entry">
<br />
<input class="btn btn-success" type="submit" name="submit" value="Submit">
<a class="btn btn-danger" href="javascript:void(0)" onclick="mapIntro();">Cancel</a>
</div>
</form>
<!-- end form -->
</div>
<!-- end form container -->
@agkd49
Copy link

agkd49 commented Mar 2, 2021

Hi Chris! Thank you so much for sharing this code. I have a question. I'm trying to add an html form to a google site. The form captures the name and email address submitted but when it tries to redirect the visitor it returns an error saying that the site refused to connect. See attached screenshot. My apologies for blacking out the domain name (client privacy). But I tried replacing it with https://www.google.com and I get the same error message. I've also tried toggling between HTTP and https and adding and removing the www. Have you had the same issue? Any ideas as to how to resolve?
Thanks again for your time.
refused-to-connect

@chrislkeller
Copy link
Author

Hi @agkd49 ...

That kind of issue sure can be frustrating.

I posted this markup quite a while back, and perhaps something has changed since then. If it's capturing the form data, that's great.

Maybe try something similar

<script type="text/javascript">var submitted=false;</script>
<iframe name="hidden_iframe" id="hidden_iframe" style="display:none;" onload="if(submitted) {window.location.href='***THIS IS THE URL OF THE PAGE TO REDIRECT'; alert('Thank you for your submission. We\'re manually updating submissions and will be adding yours soon.');}"></iframe>

@agkd49
Copy link

agkd49 commented Mar 3, 2021

Hi Chris!

Thanks for the reply. I'm a newbie to this so I really appreciated your quick reply.

I tried the slight modification above (ex. adding the href). No luck. But I will check out the link you sent me and continue my search.:) I just wanted to take a moment to thank you for responding!

  • Alicia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment