Disable 2nd Postback on Form until 1st completes

Joined
Oct 29, 2007
Messages
1
Reaction score
0
I have an asp .net page with many a few dozen buttons and dropdownlists that need to postback.

I found a nice bit of javascript code that will loop within all elements on a page that cause postback and disable them as soon as any element that can cause postback is triggered. This stops a user from getting click happy waiting for the postback to finish.
It works well but on complex pages is very slow as the loop has to scan thousands of elements.

Is there a way instead to ignore any postback request after the first, so even if a button or different buttons are pressed it simple ignores all requests after the first.

I found something that almost works.
It does the submit on 1 time to the server.
However, on the server side code behind doesn't know what was clicked.

Here's what I tried to do
On my masterpage:
<form id="form1" runat="server" onsubmit="return check_form()" >

The javascript for check_form() with some alerts.

<script language="JavaScript">
var submitted=false;
function check_form() {
if (submitted == true) {
alert ("form already submitted") ;
return false;
}
else {
submitted = true ;
alert ("form being submitted") ;
document.forms[0].submit();
}
}

I'm new to javascript so am not sure what I need to change to get it to postback and not loose what was doing the postback.

Thanks!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top