JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

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 April 24th, 2001, 11:59 AM
revangst revangst is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Posts: 2 revangst User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
We have set up a my SQL database on our intranet, and would like to prevent the form's submit button from being pressed repeatedly ( thus, re- entering the data )
Any help would be greatloy appreciated

Reply With Quote
  #2  
Old April 24th, 2001, 12:05 PM
pieux pieux is offline
Seņor Member
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2000
Posts: 1,157 pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 h 23 m 35 sec
Reputation Power: 36
I don't think you can do that, because the form can be re-submitted by reloading/refreshing the page. IMHO, the best thing to do is on the form that processes your code, check for if a session variable exists (call it whatever you want) and if not, set it to the current timestamp. If it does exist, check how close it is to the current timestamp and if it is within your tolerance (60 seconds would be good) don't process the information, but instead return a message that indicates they cannot submit the form more than once per whatever time increment you choose. Of course, you would need to do this with server-side code, not client-side code.
__________________
Michael

Reply With Quote
  #3  
Old April 24th, 2001, 02:15 PM
derrickatdev derrickatdev is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 464 derrickatdev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 51 m 27 sec
Reputation Power: 13
You can achieve this by changing the value of the submit button as the form is going to be submitted.

This code could go into the page header:

showupload="Please Wait...";

function confirmupload() {
if(document.forms[0].upload.value!=showupload) {
displaymessage = checkinfo();
if(displaymessage != "") {
alert(displaymessage);
} else {
if(getconfirmation()) {
indicateupload();
document.forms[0].submit();
}
}
}
}

function indicateupload() {
document.forms[0].upload.value=showupload;
}

The first line in the confirmupload function checks the value of the submit button, if = showupload the form will not be submitted.



For your submit button you could use:

document.write("<INPUT TYPE=\"button\" VALUE=\"Upload File\" NAME=\"upload\" ONCLICK=\"confirmupload()\">");



When you click the submit button the value will change to that of showupload. You can then check the submit buttons value to see if the form has been submitted.
__________________
:-)

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > javascript, non resubmittal of form buttons

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap