Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6734243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:51:56+00:00 2026-05-26T10:51:56+00:00

I have a web site that uses submit buttons to send commands to a

  • 0

I have a web site that uses submit buttons to send commands to a remote microprocessor. If a user clicks the submit button too many times in a short amount of time, the remote microprocessor and software will crash. I thought I could add a one-second delay between each “submit” button press so it will not crash. Here is what I have for the submit button.

<form name="test" action="http://mydomain.dyndns.org/?8" target="results" method="POST">
<input type="submit" value=" ← Move Left " />
</form>

I thought I could use something like onSubmit="setTimeout (1000)" in the form, but it doesn’t seem to be working. What am I doing wrong?

Example:

<form name="test" action="http://mydomain.dyndns.org/?8" target="results" method="POST" onSubmit="setTimeout (1000)">
    <input type="submit" value=" ← Move Left " />
</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:51:57+00:00Added an answer on May 26, 2026 at 10:51 am

    A back-end solution is preferable, but if you want to do it client-side as well (or instead):

    If your onsubmit returns false it will stop submission.

    I’d be inclined to solve this by:

    1. Temporarily disabling the button for a second so that the user can’t submit again quickly, and/or
    2. Ignoring subsequent attempts to submit unless at least a second has passed.

    I would not bother trying to queue up all the submissions and space them out, because the user could click the button lots of times.

    So, the following ignores extra attempts to submit made within a second and disables the submit button. Why do both? If the form has fields in it the user could submit by pressing the Enter key.

    <form name="test" action="http://mydomain.dyndns.org/?8" target="results"
          method="POST" onSubmit="return testSubmit();">
       <input id="submitButton" type="submit" value=" ← Move Left " />
    </form> 
    
    <script>
       var allowSubmit = true;
    
       function testSubmit() {
          if (!allowSubmit)
             return false;
    
          allowSubmit = false;
          document.getElementById("submitButton").disabled = true;
    
          setTimeout(function() {
                        allowSubmit = true;
                        document.getElementById("submitButton").disabled = false;
                     }, 1000);
    
          return true;
       }
    </script>
    

    Note this code: onSubmit="return testSubmit();" – you need the “return” in there or the value that comes back from testSubmit() is thrown away and submission will not be prevented.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web site that I administer that uses Apache 2.0 on the
I have a web site in asp.net that uses a master page. In this
I have a simple PowerShell script that uses WMI to create a web site
I am using ColdFusion 9.0.1. I have a new web site that uses Bikes.cfm
I have a web site that runs on Windows and uses cp1252 (aka Win-1252
I have an ASP.NET MVC 3 web site that uses Windows Authentication running under
i have a web site that uses forms authentication. the problem is that i
We have a web site that uses rdlc files to show some reports, but
I have an asp.net site that uses Bing Translate Web service(http://api.microsofttranslator.com/V2/Soap.svc) The code that
I have a web site that uses Microsoft Indexing Service to index and query

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.