Results 1 to 7 of 7

Thread: Auto Submit Loop Issue

  1. #1
    Join Date
    Jul 2007
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Auto Submit Loop Issue

    Hi all what is the best way to get this to stop looping, and only submit once?

    Thanks

    <script>document.frmSelect.submit();</script>

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    What do you mean? Can your provide all your code and a link to your page please?
    You should also use:

    HTML Code:
    <script type="text/javascript">
    Jeremy | jfein.net

  3. #3
    Join Date
    Jul 2007
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hey Nile I'm not at my house now and I'm having trouble remoting in but essentially the javascript is called by asp code and I really only need to call it once but it just keeps on looping.

    Thanks

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Ok.. Hmm, put this at the top of your page:
    Code:
    <script type="text/javascript">
    var once = true;
    </script>
    And replace your above code with:
    Code:
    <script type="text/javascript">
    if(once){
      document.frmSelect.submit();
    } else {
      return ;
    }
    </script>
    Jeremy | jfein.net

  5. #5
    Join Date
    Jul 2007
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi, thanks again. I made a test document and I don't think it's working. Maybe I'm implementing it wrong:

    test.asp

    Code:
    <html>
    
    <head>
    <script type="text/javascript">
    var once = true;
    </script>
    
    </head>
    
    <body>
    
    <form name="frmSelect" action="test.asp" method="post">
    <input type="text" name="test" value="test">
    <input type="submit" name="submit" value="submit">
    
    <%
    If request.form("submit") <> "" then
    response.write "submitted"
    End If
    %>
    
    </form>
    
    <script type="text/javascript">
    if(once){
      document.frmSelect.submit();
    } else {
      return ;
    }
    </script>
    
    </body>
    
    </html>

  6. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Why do you want your forum to automatically submit anyways?
    Jeremy | jfein.net

  7. #7
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by Nile View Post
    Ok.. Hmm, put this at the top of your page:
    Code:
    <script type="text/javascript">
    var once = true;
    </script>
    And replace your above code with:
    Code:
    <script type="text/javascript">
    if(once){
      document.frmSelect.submit();
    } else {
      return ;
    }
    </script>
    this will still loop. you have to set the variable once to false once it is run:
    Code:
    <script type="text/javascript">
    if(once){
      document.frmSelect.submit();
      once=false;
    } else {
      return ;
    }
    </script>
    i am not familiar with asp but try:
    Code:
    <%
    If request.form("submit") <> "" then
    response.write "submitted<script type='text/javascript'>once=false;</script>"
    End If
    %>
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •