|
For the integrity of order information, we prevent the double click in all storefront services.
|
JUST FOR FUN
Click an arrow to visit the application.
ALL THE STUFF THAT'S LEFT HANDED
PLAY OUR SLOT MACHINE, WIN NOTHING
GET RID OF THE DOUBLE CLICK SUBMIT
FIX THAT JAVASCRIPT NUMBER
KEEP TABS ON THE HEALTH OF YOUR COLDFUSION SERVER
CREATE A DYNAMIC BAR CHART
|
NO MORE DOUBLE CLICKS
This is the most elegant piece of code we've seen in a while. For years at ImagineNation
we've been preventing the multiple submittals of a form with a JavaScript function in the
head of the form page. Then we discovered this in-line code below from Stephan Tual at cfvault.com.
It not only prevents multiple clicks, but it changes the button text to let you know.
|
| | GIVE IT A TRY |
|
|
| | HERE IS THE BUTTON CODE |
|
<input type="button" name="no2s" value="Submit Form" onClick="if(this.value == 'Submit Form') this.form.submit(); this.value = 'Please Wait.';">
|
| | HOW IT WORKS |
Forms and form elements in a browser can be read and written to using JavaScript. The form event handlers
are actually JavaScript events. In this case the onClick event runs two JavaScript commands. The first is
a conditional that tests for the string "Submit Form" as the value of the button and if true submits the form.
The second command writes the string "Please Wait" to the button. When the button is clicked again, the
conditional is not true; therefore the form does not submit.
|
Writing code is like wrestling alligators:
The more you thrash around, the more gators join the fray!
|
|
|