July 20, 2008
For ColdFusion hosting try HostMySite.com. |
Home /
Groups /
ColdFusion Talk (CF-Talk)
Avoid multiple form submits
Hello Guys,Robert Rawlins 05/09/08 09:15 A <cfinputRichard Dillman 05/09/08 09:44 A Assuming that the user has JavaScript turned on you can use this bit of code, it disables the button used for submitting the form once its been clicked:Larry Lyons 05/09/08 10:16 A Thanks for the suggestions guys,Robert Rawlins 05/09/08 10:26 A If what you are looking for is just a client-side solution, the TMTMassimo Foti 05/09/08 10:53 A The Javascript example above doesnt have a TYPE="submit" so it will causeEric Haskins 05/09/08 06:50 P Massimo? As in Massimo The DW Extension Guru?Gerald Guido 05/09/08 07:28 P > Massimo? As in Massimo The DW Extension Guru?Massimo Foti 05/09/08 10:47 P A client side only solution can not ensure that this problem will not occur.Rich 05/09/08 10:34 A There is a workaround for this on my blogTony 05/11/08 01:52 P Hello Guys, I've got an issue with a form which is sometimes a little slow to process. Seems that some of the users are clicking the submit button a whole bunch of times and we're getting a few problems arise as a result of it. How are you tackling this problem? presumably something with jQuery would be nice but I wanted to get your thoughts. Any ideas and code examples welcome :-D Robert <cfinput id="submit" name="submit" type="submit" validate="submitonce" /> ----- Excess quoted text cut - see Original Post for more ----- Assuming that the user has JavaScript turned on you can use this bit of code, it disables the button used for submitting the form once its been clicked: <INPUT TYPE="Button" VALUE="Submit" onClick="if(this.value == 'Submit') this.form.submit(); this.value = 'Please Wait.';this.disabled=true;"> hth, larry Larry C. Lyons Web Analyst American Type Culture Collection http://www.atcc.org llyons(at)atcc.org ----- Excess quoted text cut - see Original Post for more ----- Thanks for the suggestions guys, The JS based solution doenst quite work for me, it seems to grey the button out and change the value to 'please wait' but doesnt actualy submit the form :-) I've read about this on a few different occasions and appears to be a problem with IE7 or something like that, I dont know, any ideas? As for the <cfinput> solution, I did try this but when the submit button is clicked it doesnt disable itself, is that correct behaviour? or should the button become disabed once it has been clicked? Thanks guys, I appreciate your input (no pun intended.) Robert If what you are looking for is just a client-side solution, the TMT Validator offers this: http://www.massimocorner.com/validator/ http://www.massimocorner.com/validator/samples/generic.htm Massimo The Javascript example above doesnt have a TYPE="submit" so it will cause weird behavior in some browsers. I bet it will work if you add it Eric On Fri, May 9, 2008 at 10:52 AM, Massimo Foti <massimo@massimocorner.com> wrote: ----- Excess quoted text cut - see Original Post for more ----- Massimo? As in Massimo The DW Extension Guru? Awesome! I just wanted to say thank you SIR!! I have been using your stuff for years. And thanx for showing up when you did. I was *just* about to write a custom tag for DHTML Calendar for work. I looked and noticed that you have not posted any of you work to riaforge.org. Any reason for this? Yours is a great contribution to the community, both CF and Web Dev in general, and riaforge.org might serve to broaden the reach of your contribution. Just a suggestion. ;) G On Fri, May 9, 2008 at 10:52 AM, Massimo Foti <massimo@massimocorner.com> wrote: ----- Excess quoted text cut - see Original Post for more ----- > Massimo? As in Massimo The DW Extension Guru? Yes. > I looked and noticed that you have not posted any of you work to > riaforge.org. Any reason for this? Yours is a great contribution to the > community, both CF and Web Dev in general, and riaforge.org might serve to > broaden the reach of your contribution. My stuff is typically free, but it's not realesed under an open-source license, that's why it's not available from riaforge.org. ---------------------------- Massimo Foti, web-programmer for hire Tools for ColdFusion and Dreamweaver developers: http://www.massimocorner.com ---------------------------- A client side only solution can not ensure that this problem will not occur. A more robust solution is to use the "Synchronizer Token Pattern" from core J2EE Patterns. Here is an excerpt from http://www.corej2eepatterns.com/Design/PresoDesign.htm: " Synchronizer (or Déjà vu) Token This strategy addresses the problem of duplicate form submissions. A synchronizer token is set in a user's session and included with each form returned to the client. When that form is submitted, the synchronizer token in the form is compared to the synchronizer token in the session. The tokens should match the first time the form is submitted. If the tokens do not match, then the form submission may be disallowed and an error returned to the user. Token mismatch may occur when the user submits a form, then clicks the Back button in the browser and attempts to resubmit the same form. On the other hand, if the two token values match, then we are confident that the flow of control is exactly as expected. At this point, the token value in the session is modified to a new value and the form submission is accepted. ... " This combined with a client side JS solution will ensure the form is only submitted once. HTH, Rich Kroll Senior Software Engineer NextWeb Media There is a workaround for this on my blog www.revolutionwebdesign .com/blog Search around you should find it in there Tw ----- Excess quoted text cut - see Original Post for more -----
|
Mailing Lists
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||