Snap Builder Public Codes Library
Snap | Generators | Login | Browse | Search | Enter Code | Export Snap Builder Public Codes Library

 

Category: Javascript Codes Library >> Forms, Radio, Buttons, Check Box >> Disable Form Button


Code Snippet </> Info


Snippet Name: Disable Form Button

Description: This script will disable your submit button in order to prevent multiple form submissions.

Compatible Browsers:
Chrome BrowserFirefox BrowserInternet Explorer BrowserOpera BrowserSafari Browser

Note:

Author: Justin Barlow

Last Modified: 2014-05-16 15:13:22

Language: javascript

Highlight Mode: javascript

Copy Codes: Use Free Notepad ++
Bookmark and Share

Snap HTML Code Editor:
Paste the source code, make changes and instantly see it in live preview.
Snap HTML Code Editor


  About Copying
Copied To Clipboard!

<html> <head> <title>Disable Form Button Javascript Code Snippet</title> <script> /* Begin Disable Form Button == This Script Free To Use Providing This Notice Remains == == This Script Has Been Found In The http://www.SnapBuilder.com Free Public Codes Library == == NOTICE: Though This Material May Have Been In A Public Depository, Certain Author Copyright Restrictions May Apply == == Created by: Justin Barlow : http://www.netlobo.com : Creative Commons License == */ function disableSubmit(whichButton) { if (document.getElementById) { // this is the way the standards work document.getElementById(whichButton).disabled = true; } else if (document.all) { // this is the way old msie versions work document.all[whichButton].disabled = true; } else if (document.layers) { // this is the way nn4 works document.layers[whichButton].disabled = true; } } </script> </head> <body> <p>This script will disable your submit button in order to prevent multiple form submissions.</p> <form method="post" action="yourProcessingScript.php" onsubmit="return disableSubmit('mFormSubmit')"> <table> <tr> <td>Name:</td> <td><input type="text" name="name"></td> </tr> <tr> <td>Email:</td> <td><input type="text" name="email"></td> </tr> <tr> <td>Message:</td> <td><textarea name="message" rows="4" cols="30"></textarea></td> </tr> <tr> <td colspan="2" style="text-align: center"><input type="submit" name="submit" id="mFormSubmit" value="Send Message"></td> </tr> </table> </form> </body> </html>


[ Snippet Options ]

 

© 2002 -  Snap Builder Public Codes Library