ECatsBlog
  • Home
  • Web Dev
  • Reviews
  • Thoughts
  • ASP
  • SQL
  • Browser
  • Mobile
  • Cloud
  • CMS
  • ECommerce
  • App Hacks
  • Fixes
  • Mapping
  • 3D Printing
  • XAML
  • SEO

Categories

  • 3D Printing (1)
  • App Hacks (5)
  • ASP (22)
  • Browser (13)
  • Cloud (10)
  • CMS (7)
  • ECommerce (6)
  • Fixes (5)
  • Mapping (1)
  • Mobile (12)
  • Reviews (70)
  • SEO (9)
  • SQL (12)
  • Thoughts (60)
  • Uncategorized (1)
  • Web Dev (94)
  • XAML (9)

Archives

  • October 2024 (2)
  • December 2022 (1)
  • October 2022 (1)
  • February 2022 (1)
  • June 2019 (1)
  • January 2019 (175)
  • December 2018 (47)

Form stopping action

When Written: Nov 2006

Whilst browsing the other day I ended up on the excellent site ‘Four Guys from Rolla’ ( http://www.4guysfromrolla.com ). This site has so many good articles on it that if you are working with ASP or ASP.NET it should be obligatory reading for you. The particular article I was interested in covered the problem of stopping the user clicking a submit button twice. By doing this it is possible to stop a lot of double postings from users into databases. This can be done with a little javascript code:

<script>
   function DisableButton(b)
   {
      b.disabled = true;
      b.value = 'Submitting';
      b.form.submit();
   }
</script>

And calling it when the user clicks the submit button

  <input type="submit" name="SubmitButton" id="SubmitButton"
          value="Submit"
          onclick="DisableButton(this);" />

What happens when the user clicks the button on a web page is that the text on the button changes from ‘Submit’ to ‘Submitting’ and the button is disabled so further clicks on it will have no effect. Simple but effective

Article by: Mark Newton
Published in: Mark Newton

  • Previous Death of Classic ASP ?6 years ago
  • Next Intelli- dense?6 years ago

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • .net application moving files
  • Dealing with accents on database driven web site
  • Neat feature in Chrome
  • Unable to ping VM machine from host
  • SMTP Email Client

Recent Comments

    2025 ECatsBlog. Donna Theme powered by WordPress