473,566 Members | 3,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GOOD SCRIPT BUT JUST ONE PROBLEM : Stop an "Unonload" when then confirmation is false

1 New Member
Problem : Stop an "Unonlaod" when then confirmation is false.

Is a really good script but i have just one problem. The problem that i have is when i click on a link. The scipt ask "Do you want to save DATA". When you click "Yes" and the name form is empty. The script tell you a message, but i go to another page. ALL I WANT IS TO BLOCK IT, AND STAY IN THE SAME PAGE WITHOUT RELOADING. LIKE WHEN YOU CLICK SUBMIT.

Can some one help me ?
Is a good script but i have only one problem ?
donald.loignon@ cgocable.ca


Here is the script

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body onunload="Close WindowSauvegard e()">

<p>
<SCRIPT LANGUAGE="JavaS cript">

function CloseWindowSauv egarde ()
{
var answer = confirm ("DO YOU WANT TO SAVE DATA")
if (answer)
{
return FrontPage_Form1 _Validator(form ulaire);
}
else
{
alert ("LOST YOUR DATA");
}
}

// *********** VALIDATION
function FrontPage_Form1 _Validator(theF orm)
{
if ((theForm.Nom.v alue.length < 1) || (theForm.Nom.le ngth > 225))
{
alert("NAME must contain NAME OF the COMPANY must contain between 1 and 225 characters. ");
theForm.Nom.foc us();
return (false);
}
return (true);
document.formul aire.submit ();
}


</script>
</p>
<p><a href="http://www.google.ca"> Change lick with save</a></p>
<form name="formulair e" method="post" action="s-compagnie.asp" onsubmit="retur n FrontPage_Form1 _Validator(this )">
Name :
<input name="Nom" type="text" id="Nom">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
Sep 22 '06 #1
1 2560
r035198x
13,262 MVP
Problem : Stop an "Unonlaod" when then confirmation is false.

Is a really good script but i have just one problem. The problem that i have is when i click on a link. The scipt ask "Do you want to save DATA". When you click "Yes" and the name form is empty. The script tell you a message, but i go to another page. ALL I WANT IS TO BLOCK IT, AND STAY IN THE SAME PAGE WITHOUT RELOADING. LIKE WHEN YOU CLICK SUBMIT.

Can some one help me ?
Is a good script but i have only one problem ?
donald.loignon@ cgocable.ca


Here is the script

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body onunload="Close WindowSauvegard e()">

<p>
<SCRIPT LANGUAGE="JavaS cript">

function CloseWindowSauv egarde ()
{
var answer = confirm ("DO YOU WANT TO SAVE DATA")
if (answer)
{
return FrontPage_Form1 _Validator(form ulaire);
}
else
{
alert ("LOST YOUR DATA");
}
}

// *********** VALIDATION
function FrontPage_Form1 _Validator(theF orm)
{
if ((theForm.Nom.v alue.length < 1) || (theForm.Nom.le ngth > 225))
{
alert("NAME must contain NAME OF the COMPANY must contain between 1 and 225 characters. ");
theForm.Nom.foc us();
return (false);
}
return (true);
document.formul aire.submit ();
}


</script>
</p>
<p><a href="http://www.google.ca"> Change lick with save</a></p>
<form name="formulair e" method="post" action="s-compagnie.asp" onsubmit="retur n FrontPage_Form1 _Validator(this )">
Name :
<input name="Nom" type="text" id="Nom">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
I think you should remove this

document.formul aire.submit ();
Sep 22 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4538
by: Robert Dickow | last post by:
This code works perfectly in IExplorer, but in exactly the same context does not work at all in Netscape 7.x. <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript"> <!-- if (window.parent.opener.closed) { window.parent.close(); }; // -->
11
1272
by: The Natural Philosopher | last post by:
1/. Can anyone tell me why renaming a function from 'update()' to 'form_update()' makes Safari work when it didn't before? 2/. I would LIKE if possible, to do the following. User is filling in a BIG form. MYSQL/PHP generated. he finds that the option he needs in a select statement isn't there, and needs to be added via a different form.
0
7673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7893
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6263
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2085
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.