0

I have a simple form. On submit (the submit action is a google docs form submission), it takes to a new page with focus on that page. I want to keep the focus on the current page.

What are my options?

This is the code (also present here )

<html><body>
    <form action="https://docs.google.com/a/rangde.org/spreadsheet/formResponse?formkey=dFlSZkt0TzZTWHJyblBiQlNrcmZvZGc6MQ" method="POST" id="ss-form" target="_blank" onsubmit="submitted=true;">
<br>
<input type="text" name="entry.0.single" value="" class="ss-q-short" id="entry_0" placeholder="Your Name">
<br>
<input type="text" name="entry.1.single" value="" class="ss-q-short" id="entry_1" placeholder="E-mail Address">
<br>
<input type="text" name="entry.2.single" value="" class="ss-q-short" id="entry_2" placeholder="Pledge Amount">
<br>
<input type="submit" name="submit" value="Submit"></form>
    </body>
</html>
TJ-
  • 14,085
  • 12
  • 59
  • 90
  • I found a sweet solution to my problem here : http://stackoverflow.com/questions/4351188/can-i-submit-form-info-to-google-spreadsheets-with-jquerys-ajax – TJ- Dec 15 '11 at 17:20

3 Answers3

1

Depending on what you're trying to do with the resulting form, (and if you're not comfortable relying js do all the lifting) you could also create a hidden iframe on the page, give it a name, and set the form target to the name of the iframe. This is only if you have no interest in having the user ever see the google page itself.

Ben D
  • 14,321
  • 3
  • 45
  • 59
0

Try AjaxForm, as found at http://jquery.malsup.com/form/, if you're using jQuery

  • This option looked very promising, but looks like google won't let me do so. These are the errors that were thrown: "Failed to load resource: the server responded with a status of 405 (Method Not Allowed)" and "XMLHttpRequest cannot load - Origin null is not allowed by Access-Control-Allow-Origin." – TJ- Dec 15 '11 at 17:06
  • Ah ok. It does come in very useful usually, but I guess only when the action's held on your own server (or doesn't have whatever Google has given it stops it from processing, perhaps). It's especially good when used with a callback to `slideUp()` the form and display a success message. –  Dec 15 '11 at 17:21
0

A form's action parameter will always take you to that page.

Here is an example: POST without Form Method (PHP)

Community
  • 1
  • 1
brpyne
  • 996
  • 9
  • 14