473,324 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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

1
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>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body onunload="CloseWindowSauvegarde()">

<p>
<SCRIPT LANGUAGE="JavaScript">

function CloseWindowSauvegarde ()
{
var answer = confirm ("DO YOU WANT TO SAVE DATA")
if (answer)
{
return FrontPage_Form1_Validator(formulaire);
}
else
{
alert ("LOST YOUR DATA");
}
}

// *********** VALIDATION
function FrontPage_Form1_Validator(theForm)
{
if ((theForm.Nom.value.length < 1) || (theForm.Nom.length > 225))
{
alert("NAME must contain NAME OF the COMPANY must contain between 1 and 225 characters. ");
theForm.Nom.focus();
return (false);
}
return (true);
document.formulaire.submit ();
}


</script>
</p>
<p><a href="http://www.google.ca">Change lick with save</a></p>
<form name="formulaire" method="post" action="s-compagnie.asp" onsubmit="return 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 2543
r035198x
13,262 8TB
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>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body onunload="CloseWindowSauvegarde()">

<p>
<SCRIPT LANGUAGE="JavaScript">

function CloseWindowSauvegarde ()
{
var answer = confirm ("DO YOU WANT TO SAVE DATA")
if (answer)
{
return FrontPage_Form1_Validator(formulaire);
}
else
{
alert ("LOST YOUR DATA");
}
}

// *********** VALIDATION
function FrontPage_Form1_Validator(theForm)
{
if ((theForm.Nom.value.length < 1) || (theForm.Nom.length > 225))
{
alert("NAME must contain NAME OF the COMPANY must contain between 1 and 225 characters. ");
theForm.Nom.focus();
return (false);
}
return (true);
document.formulaire.submit ();
}


</script>
</p>
<p><a href="http://www.google.ca">Change lick with save</a></p>
<form name="formulaire" method="post" action="s-compagnie.asp" onsubmit="return 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.formulaire.submit ();
Sep 22 '06 #2

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

Similar topics

4
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...
11
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.