questor
05-14-2004, 08:12 AM
Heya, this is my first post here.
Now that I understand a bit of javascript I'm going through my apps and removing php form control and adding javascript. The basic 'did you complete all required fields' stuff. Obviously javascript is better because it will do it before you leave the page.
Well, on one page it's not working; it just lets the user glide on to the next page without input and without the err msg. I don't see how it's significantly different than any other page.
Here's the code.
<?php
include("functions.php");
secure();
$dbconnect=@mysql_connect("localhost","###","###");
if (!$dbconnect) {
die ("Error: No connection to the server established. ".mysql_error());
}
mysql_select_db("pmap");
?>
<script>
self.resizeTo(460,460);
</script>
<HTML>
<head>
<title>THE SEXTANT</title>
<link rel="stylesheet" type="text/css" href="main.css">
<script>
function validate()
{
old=mainform.old_password.value;
new=mainform.new_password.value;
fail=0;
if (old=='')
{
fail=1;
}
if (new=='')
{
fail=1;
}
if (fail==1)
{
alert('Please complete all fields.');
event.returnValue=false;
}
}
</script>
</head>
<body>
<center><img src="./images/step_one.jpg"></center>
<center><table align=center border="0"></center>
<tr><td class="noBorder" valign="top">
<img src="./images/sextant_background.jpg">
<div id="menu">
<form name="mainform" action="passchangeaction.php" method="post" onsubmit="validate();">
<center><table></center>
<tr><td>
Old Password:</td><td><input type="password" name="old_password" size="10"></input></td></tr><td>
New Password:</td><td><input type="password" name="new_password" size="10"></input></td></tr>
<tr><td> </td></tr>
<tr><td align=center colspan=2><input type="Submit" value="Update Password"></td></tr>
</table>
</form>
</table>
</div>
<div id="nav">
<center><A HREF="index.php"><img src="./images/back_arrow.gif" alt="Back" border=0></A> <A
HREF="index.php"><img src="./images/up_arrow.gif" alt="Home" border=0></A></center>
</div>
</body>
</html>
Now that I understand a bit of javascript I'm going through my apps and removing php form control and adding javascript. The basic 'did you complete all required fields' stuff. Obviously javascript is better because it will do it before you leave the page.
Well, on one page it's not working; it just lets the user glide on to the next page without input and without the err msg. I don't see how it's significantly different than any other page.
Here's the code.
<?php
include("functions.php");
secure();
$dbconnect=@mysql_connect("localhost","###","###");
if (!$dbconnect) {
die ("Error: No connection to the server established. ".mysql_error());
}
mysql_select_db("pmap");
?>
<script>
self.resizeTo(460,460);
</script>
<HTML>
<head>
<title>THE SEXTANT</title>
<link rel="stylesheet" type="text/css" href="main.css">
<script>
function validate()
{
old=mainform.old_password.value;
new=mainform.new_password.value;
fail=0;
if (old=='')
{
fail=1;
}
if (new=='')
{
fail=1;
}
if (fail==1)
{
alert('Please complete all fields.');
event.returnValue=false;
}
}
</script>
</head>
<body>
<center><img src="./images/step_one.jpg"></center>
<center><table align=center border="0"></center>
<tr><td class="noBorder" valign="top">
<img src="./images/sextant_background.jpg">
<div id="menu">
<form name="mainform" action="passchangeaction.php" method="post" onsubmit="validate();">
<center><table></center>
<tr><td>
Old Password:</td><td><input type="password" name="old_password" size="10"></input></td></tr><td>
New Password:</td><td><input type="password" name="new_password" size="10"></input></td></tr>
<tr><td> </td></tr>
<tr><td align=center colspan=2><input type="Submit" value="Update Password"></td></tr>
</table>
</form>
</table>
</div>
<div id="nav">
<center><A HREF="index.php"><img src="./images/back_arrow.gif" alt="Back" border=0></A> <A
HREF="index.php"><img src="./images/up_arrow.gif" alt="Home" border=0></A></center>
</div>
</body>
</html>