HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 1st, 2000, 04:56 PM
devCisk devCisk is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 29 devCisk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
What is the best way to stop people from pressing the submit button more than once and having mutiple insertions. Basically when a user clicks submit 3 or 4 times i get 3 or 4 signatures in my guestbook

Cisk

Reply With Quote
  #2  
Old June 2nd, 2000, 01:49 PM
Argrajoca Argrajoca is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2000
Location: SPAIN
Posts: 47 Argrajoca User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
You can try the following:

in the form tag, add:

<form .... onSubmit="checkifsend()">

and create a Javascript function like:

function checkifsend()
{
if (Hasbeensend)
{return false}
else {Hasbeensend=true; return true}
}

Note:Hasbeensend has to be defined as false when loading the page, inside the <script> section.

Explanation: When the form is send, the script checks if it has been sended before. If it's the first time, it changes the value of Hasbeensend to true and submits it, avoiding other submits.


Reply With Quote
  #3  
Old June 2nd, 2000, 11:38 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Pembroke Pines, Florida, USA
Posts: 2,300 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 3 h 2 m 4 sec
Reputation Power: 43
I really don't understand how it's possible to submit more than once, unless the form ACTION is to submit to itself (rather than forward the values to another page).

Basically, once you hit submit, the page to which the ACTION goes starts loading immediately, so it's impossible to click the same button twice. I've even tried using the middle button of my mouse (which is configured as a double-click) to submit a form and I only get one action.

I would guess that there are two possibilities:
1. the form ACTION is handled inside the same file in which the user fills out the form, thus presenting the button for a second click
2. the user is not clicking the button twice, but is refreshing the page after submitting, which submits the page again. That would require some other code, perhaps using a cookie.

If I'm wrong, please explain, because I have never been able to reproduce the "double-click submit" phenomenon.

Reply With Quote
  #4  
Old June 3rd, 2000, 12:59 AM
devCisk devCisk is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 29 devCisk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Argrajoca:
Thanks a lot! That works great

rycamor:
Well youre right. The form calls the same page. I've trie drefreshing the page, after submission, and it has never re-submitted information using both GET and POST. I have another contact form on my webpage that spans 2 .php pages and i'm going to test out submitting more than once on that one.
http://www.txraves.org/djcisk/signbook.php - is the page that i have the form in. I also used the .disable javascript functiont to disable the button

Cisk

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Mutiple Submits


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway