I'm not sure where to put this...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shmanny
    New Member
    • Nov 2007
    • 4

    I'm not sure where to put this...

    My issue is with a page that uses a database, java, and asp; I need to find a way to use the setTimeout function in a page that is submitting information to a database and therefore, continually reloading and resetting the timeout.

    If anyone can help me with this, I would be much obliged. Thank you.

    Shmanny
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    hi ...

    i think it's a javascript-question? ... you may use the setInterval()-method instead of setTimeout() here ...

    kind regards

    Comment

    • shmanny
      New Member
      • Nov 2007
      • 4

      #3
      Originally posted by gits
      hi ...

      i think it's a javascript-question? ... you may use the setInterval()-method instead of setTimeout() here ...

      kind regards
      Well I just checked my code, and I am using the setInterval function with a window.close, and it doesn't work until the window is inactive for the specified time period. So the result is the same whether I use setInterval or setTimeout; as long as I continue to input and submit data, the window remains open beyond the specified time period.

      What I am trying to achieve here is to allow a user to submit data for a certain length of time; perhaps I'm going about this in the wrong way.

      Best regards,
      Shmanny

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        hi ...

        could you please post an example ... so that we may have a closer look at it ... as far as i understand you open an popup? and the user may input some data ... and after a specific amount ot time the window should be closed?

        kind regards

        Comment

        • shmanny
          New Member
          • Nov 2007
          • 4

          #5
          Originally posted by gits
          hi ...

          could you please post an example ... so that we may have a closer look at it ... as far as i understand you open an popup? and the user may input some data ... and after a specific amount ot time the window should be closed?

          kind regards
          The URL for the popup window is this: http://www.flyoutcasts.com/members/v...CandidateID=15

          The setInterval function is contained in an external javascript, as I have two onload functions running for the same window.

          This window is opened by a button on this page: http://www.flyoutcasts.com/members/v...CandidateID=15

          Each time the form is submitted, one vote is added to a table in an Access database; I want to allow 30 seconds of "voting time" every 10 minutes (I will work on the 10 minutes part after I get the 30 seconds working). This is temporarily set for 5 seconds, for testing purposes.

          Hopefully this makes sense; thank you again, gits.

          Best regards,
          Shmanny

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #6
            hi ...

            i see ... the purpose of this is to let the user vote a determined time only, he could do that as long as the window stays open?

            so you are on the right track with setTimeout() to close the window. but you shouldn't submit your form ... you may do an ajax-call instead ... so that the form is not refreshed every time you submit it. for a quickstart have a look at this article or go through the offsite links that you find at top of the TSDN-javascript-forum ...

            kind regards

            Comment

            • shmanny
              New Member
              • Nov 2007
              • 4

              #7
              Originally posted by gits
              hi ...

              i see ... the purpose of this is to let the user vote a determined time only, he could do that as long as the window stays open?

              so you are on the right track with setTimeout() to close the window. but you shouldn't submit your form ... you may do an ajax-call instead ... so that the form is not refreshed every time you submit it. for a quickstart have a look at this article or go through the offsite links that you find at top of the TSDN-javascript-forum ...
              Correct. I will look into this. Thank you!

              Comment

              Working...