473,735 Members | 2,103 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 2568
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
4547
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
1286
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
8784
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9326
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9199
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8199
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6747
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6049
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4821
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3270
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
2
2738
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.