Ok,
I've posted on this before, lemme give you guys the run
down. I've got an asp form that has postbacks etc. I'd
like it so that when navigating away from it, It'll prompt
user for save confirmation.
So I've got <body onUnLoad="CheckConfirm();">
The javascript method fires off, and I've got no question
if I could call a remote scripting method to trigger a
save.
My problem is that a postback fires off the javascript
unload event. I tried checking document.location.href, but
thats prior to hitting the button, and being that its not
the new destination url, its more or less impossible to
ignore postbacks.
Anyone found a work around? I dont want to save every
postback, or prompt for a save. (doing so could publically
publish information that could possibly not be ready for
publics eyes)
Thank you very much for the time.
Weston Weems 3 2169
Weston, the quickest solution I can think of:
<script language="javascript">
var isPostback = false;
function unloading(){
if (!isPostback){
alert('Not caused by postback');
}
}
</script>
<body onunload="unloading();">
<form id="Form1" method="post" runat="server" onsubmit="isPostback =
true;">
...
</form>
</body>
--
MY ASP.Net tutorials http://www.openmymind.net/
"Weston Weems" <an*******@discussions.microsoft.com> wrote in message
news:6e****************************@phx.gbl... Ok,
I've posted on this before, lemme give you guys the run down. I've got an asp form that has postbacks etc. I'd like it so that when navigating away from it, It'll prompt user for save confirmation.
So I've got <body onUnLoad="CheckConfirm();">
The javascript method fires off, and I've got no question if I could call a remote scripting method to trigger a save.
My problem is that a postback fires off the javascript unload event. I tried checking document.location.href, but thats prior to hitting the button, and being that its not the new destination url, its more or less impossible to ignore postbacks.
Anyone found a work around? I dont want to save every postback, or prompt for a save. (doing so could publically publish information that could possibly not be ready for publics eyes)
Thank you very much for the time. Weston Weems
Well now, thats an interesting approach, but doesnt
account for refreshes and such. I am curious if theres a
way I can get a reference to the new page or something...
I know if its href is "myurl.aspx" then dont bother doing
anything.
Also, I know its bad bad, but somone calls _doPostback(...
in js explicitly, which I know is badbad, but that also
fires the postback and says "not caused by postback". -----Original Message----- Weston, the quickest solution I can think of: <script language="javascript"> var isPostback = false; function unloading(){ if (!isPostback){ alert('Not caused by postback'); } } </script> <body onunload="unloading();"> <form id="Form1" method="post" runat="server"
onsubmit="isPostback =true;"> ... </form> </body>
-- MY ASP.Net tutorials http://www.openmymind.net/
"Weston Weems" <an*******@discussions.microsoft.com>
wrote in messagenews:6e****************************@phx.gbl... Ok,
I've posted on this before, lemme give you guys the run down. I've got an asp form that has postbacks etc. I'd like it so that when navigating away from it, It'll
prompt user for save confirmation.
So I've got <body onUnLoad="CheckConfirm();">
The javascript method fires off, and I've got no
question if I could call a remote scripting method to trigger a save.
My problem is that a postback fires off the javascript unload event. I tried checking document.location.href,
but thats prior to hitting the button, and being that its
not the new destination url, its more or less impossible to ignore postbacks.
Anyone found a work around? I dont want to save every postback, or prompt for a save. (doing so could
publically publish information that could possibly not be ready for publics eyes)
Thank you very much for the time. Weston Weems
.
Actually, I may have jumped the gun a bit on this one...
I understand the theory on this rather well, but what I am
seeing is that if I say hit an edit button on a datagrid,
its saying "Not caused by a postback"
I think because the page in essence reloads itself,
resetting itself back to isPostback=false; -----Original Message----- Weston, the quickest solution I can think of: <script language="javascript"> var isPostback = false; function unloading(){ if (!isPostback){ alert('Not caused by postback'); } } </script> <body onunload="unloading();"> <form id="Form1" method="post" runat="server"
onsubmit="isPostback =true;"> ... </form> </body>
-- MY ASP.Net tutorials http://www.openmymind.net/
"Weston Weems" <an*******@discussions.microsoft.com>
wrote in messagenews:6e****************************@phx.gbl... Ok,
I've posted on this before, lemme give you guys the run down. I've got an asp form that has postbacks etc. I'd like it so that when navigating away from it, It'll
prompt user for save confirmation.
So I've got <body onUnLoad="CheckConfirm();">
The javascript method fires off, and I've got no
question if I could call a remote scripting method to trigger a save.
My problem is that a postback fires off the javascript unload event. I tried checking document.location.href,
but thats prior to hitting the button, and being that its
not the new destination url, its more or less impossible to ignore postbacks.
Anyone found a work around? I dont want to save every postback, or prompt for a save. (doing so could
publically publish information that could possibly not be ready for publics eyes)
Thank you very much for the time. Weston Weems
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Gord |
last post by:
Hello,
If you set the flag for an overwrite prompt using the 'Save' common dialog,
how do you read the response when the user clicks the Yes or No in the
'overwrite' message box?
Everything...
|
by: Michael |
last post by:
I am reading and setting a cookie using JavaScript in the BODY onload
and onunload events respectively. This works fine.
However when I use ASP to set the cookie under some condition where I...
|
by: Brian |
last post by:
Hi
I'm trying to get a small script working I need to get the user to
input some info from a prompt and then use that info in
a PHP script, but I can't seem to assign the JavaScript var
to a...
|
by: Luke - eat.lemons |
last post by:
Hi,
I have this function:
<script type="text/javascript">
function disp_prompt() {
var reqid=prompt("Please enter the membership ID number","")
if (reqid!=null && reqid!="") {
reqid=reqid
}
|
by: vinya |
last post by:
<html>
<head>
<script type="text/javascript">
var element;
function test(){
abc = document.getElementById('promptbox').value;
document.forms.elements.value = abc;
...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
| |