473,466 Members | 1,413 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Disable web page controls during postback round-trip

We want to prevent user from being able to click on a button twice or
click on other controls while processing is going on. I tried the
following javascript code (which was suggested in this group but it
didn't really work). User can click on "print" button and then before
postback, they can click on "cancel" button. Any other suggestions?
function ignoreinput() (
return false;
}
function stop_input() {
window.attachEvent(""onkeydown"", ignoreinput); " _
window.attachEvent(""onclick"", ignoreinput); " _
}
Then in the form element of the page add an onsubmit entry..

<form id="Form1" method="post" runat="server" onsubmit="stop_input();">

Dec 10 '06 #1
2 4367
Hi,
Actually following sentence in your code needs to be corrected:
InCorrect :<form id="Form1" method="post" runat="server"
onsubmit="stop_input();">
Correct One : <form id="Form1" method="post" runat="server" onsubmit="return
stop_input();">

Anyway two solutions provided in the following URL will surely solve your
probelm:
http://www.codersource.net/published...rocessing.aspx.

Thanks and regards,
manish bafna
"Sehboo" wrote:
We want to prevent user from being able to click on a button twice or
click on other controls while processing is going on. I tried the
following javascript code (which was suggested in this group but it
didn't really work). User can click on "print" button and then before
postback, they can click on "cancel" button. Any other suggestions?
function ignoreinput() (
return false;
}
function stop_input() {
window.attachEvent(""onkeydown"", ignoreinput); " _
window.attachEvent(""onclick"", ignoreinput); " _
}
Then in the form element of the page add an onsubmit entry..

<form id="Form1" method="post" runat="server" onsubmit="stop_input();">

Dec 10 '06 #2
Manish,

It didn't work. I am copying the header section from my page here -
maybe I am missing something

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD> <TITLE></TITLE>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<script language="JavaScript">history.forward();
function ignoreinput()
{return false;}
function stop_input()
{
window.attachEvent("onkeydown", ignoreinput);
window.attachEvent("onclick", ignoreinput);
}
</script>
</HEAD>
<BODY LEFTMARGIN=0 TOPMARGIN=0 BOTTOMMARGIN=0 RIGHTMARGIN=0
onLoad='javascript:setDefaultButtonScript()'>
<form name="_ctl16" method="post" action="MyPage.aspx"
language="javascript" onsubmit="return stop_input();" id="_ctl16"
runat="server">

I have two buttons on this page, print and cancel. Print takes about
10 seconds to print the report and cancel just take you back to the
previous page. If I click on print and after two seconds, click on
cancel then it takes me back to the previous page. What I want is that
once user clicks on print, all the other controls should be disabled
(or ignored).

I haven't looked at the other examples on the link - if this doesn't
work then I will look into that.

thanks

Manish Bafna wrote:
Hi,
Actually following sentence in your code needs to be corrected:
InCorrect :<form id="Form1" method="post" runat="server"
onsubmit="stop_input();">
Correct One : <form id="Form1" method="post" runat="server" onsubmit="return
stop_input();">

Anyway two solutions provided in the following URL will surely solve your
probelm:
http://www.codersource.net/published...rocessing.aspx.

Thanks and regards,
manish bafna
"Sehboo" wrote:
We want to prevent user from being able to click on a button twice or
click on other controls while processing is going on. I tried the
following javascript code (which was suggested in this group but it
didn't really work). User can click on "print" button and then before
postback, they can click on "cancel" button. Any other suggestions?
function ignoreinput() (
return false;
}
function stop_input() {
window.attachEvent(""onkeydown"", ignoreinput); " _
window.attachEvent(""onclick"", ignoreinput); " _
}
Then in the form element of the page add an onsubmit entry..

<form id="Form1" method="post" runat="server" onsubmit="stop_input();">
Dec 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
2
by: Sam | last post by:
I have a custom control (MyTextBox - taken from Microsoft website) that implements the IPostBackDataHandler interface. It is added to the controls collection of a placeholder control during the...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
6
by: Glenn Owens | last post by:
I have an ASP.Net page on which there are serveral static controls (listboxes, radiobuttonlist and textboxes). These controls are used to create criteria from which the code-behind will dynamically...
6
by: GD | last post by:
Hi, I wonder how to disable the "submit" behavior of a button. What I want is to assign values to dynamically added user controls without page postback. Problem: dynamically created control can...
2
by: Fluxray | last post by:
--Background: I have a webform including a datagrid. The datagrid is using template. Its ItemTemplate is used to display a look-up-table with labels. its EditItemTemplate is used to edit a row in...
0
by: seven | last post by:
I have a base page with an HTMLForm object (added to the base page control heiarchy during Init). In the design of pages derived from this base page, I can choose to create controls and add them...
0
by: Robert Ladd | last post by:
Hi, I'm trying to disable the asp.net calendar control from a javascript function, but it doesn't disable the doPostBack. To simplify the situation, assume a page with 4 controls. A...
9
by: junlia | last post by:
Does anyone how how can we disable the auto-postback feature in asp.net page? I have to use a server side control in the page, but the auto post back feature in it causes problems for me. Please...
0
JimWu
by: JimWu | last post by:
I have some problems in my code. The stutiation illustrate as the followsing statement. I use two pages, one, named "upload.aspx", is including several general html input tag, whose type are...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.