JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 16th, 2004, 05:19 AM
G4Gun G4Gun is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 1 G4Gun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Preventing form submission twice on doubleclick in NN6.

Hi,
I have a form in which I have this link :- <a href="javascript:submitform(parameters );"> . In the JavaScript function submitform, there is the code for submitting the form.This works fine with single click on both IE, NN6.In IE the form is submitted only once even for double click.But if you double click on the link in NN6, the form is submitted twice. This causes problem. The workaround for this was that we set a flag(indicating form submission) in the submitform function, we also set a timer which calls the function resetflag after 3 seconds.So any click within 3 seconds of the first click will be ignored (so that the form is not submitted for the second click).

function submitform(params)
{
if(flag==0)
{
flag=1;
timeout = setTimeout('resetflag()',3000);
document.form1.action = someURL;
document.form1.submit();
}

}

function resetflag()
{
flag=0;
}
.
.
.
.
.
.
.
//Global Javascript variables initialization.Executed while page loading.
var flag=0;
var timeout=0;

But the problem now is that, the event fired on the first click submits the form to the server.The second click is ignored since the flag is 0.But the results to be showed for the first click event fired are not shown.The page just stands still as if no event was fired.

I dont want to show any alerts or message like 'Double click is not allowed'. I just want a situation where double click has the same effect as single clicki.e. form should be submitted only once(as in single click) and the results should be displayed. Can Anyone Help?

Reply With Quote
  #2  
Old February 16th, 2004, 06:49 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
Why not just use a button (or submit), and set its "disabled" property when clicked?
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Preventing form submission twice on doubleclick in NN6.


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 1 hosted by Hostway