onload Submit Google Form Endless Loop

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • johnlanglois
    New Member
    • Jan 2008
    • 3

    onload Submit Google Form Endless Loop

    I have a page that uses php to process a form and send the results to the page that is misbehaving.

    The php fills in the form fields on the new page.
    I use javascript that executes onload and submits the form to Google.

    The form submits to itself and the results from Google are posted below the form.

    Everything works as expected, except the page gets caught in and endless loop.

    I tried testing for and erasing the variable that gets passed to Google, but it doesn't matter. I have tried using submit() on the form and click() on the button, but get the same results.

    If I don't process the form onload and instead just click the submit button, everything works perfectly.

    What is it about onload that is tormenting me?

    THe code is short.

    Thanks.

    Code:
    <script language="JavaScript" type="text/javascript">
    function GoogleSet(){
     // quit if this function has already been called
    if(GoogleVar){
      GoogleVar = false;
      // flag this function so we don't do the same thing twice
    document.getElementById('sa').click();
    }
    }
    </script>
  • pronerd
    Recognized Expert Contributor
    • Nov 2006
    • 392

    #2
    Originally posted by johnlanglois
    except the page gets caught in and endless loop.
    How do you know? What is it that actually happens?



    Originally posted by johnlanglois
    What is it about onload that is tormenting me?
    Since your question relates to the onload event then you need to show code that sets the onload event.

    Comment

    Working...