dcsimg
Preventing form submission twice on doubleclick in NN6.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Gun_Mali
Posted On:   Monday, February 16, 2004 01:49 AM

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)    More>>

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?    <<Less

Re: Preventing form submission twice on doubleclick in NN6.

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, February 17, 2004 06:35 AM

One simple thing is to disable the submit button, just before submitting the form.

About | Sitemap | Contact