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 (4)
  • ASP (20)
  • Browser (12)
  • Cloud (10)
  • CMS (7)
  • ECommerce (6)
  • Fixes (3)
  • Mapping (1)
  • Mobile (12)
  • Reviews (70)
  • SEO (9)
  • SQL (12)
  • Thoughts (59)
  • Uncategorized (1)
  • Web Dev (92)
  • XAML (9)

Archives

  • 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 ?3 years ago
  • Next Intelli- dense?3 years ago

Leave a Reply Cancel reply

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

Recent Posts

  • SMTP Email Client
  • IIS8 SMTP setup
  • 3D printing the Ness of Brodgar
  • Which phone is best?
  • Mobile Apps

Recent Comments

  • Quality assurance services on Windows 10 phone and HERE Maps – Fixed!
  • HP Deskjet 3755 Wireless Printer Setup on Windows 10 phone and HERE Maps – Fixed!
2022 ECatsBlog. Donna Theme powered by WordPress