code:It goes in here just fine, but it doesn't work. Putting an Alert before the last if is ignored it seems to only bother checking the first 2 ifs and then jumps over to return true its not making any sense.function checkForm()
{
var flgError = 0;
var errorMsg = "";
try {
if( document.edit.username.value == "" )
{
alert("Hello");
errorMsg+= "username cannot be left blank.\n";
document.edit.username.focus();
}
if( document.edit.public_name.value == "" )
{
alert("Hmm");
errorMsg+= "public_name cannot be left blank.\n";
document.edit.public_name.focus();
}
if( document.edit.firstname.value == "" )
{
errorMsg+= "firstame cannot be left blank.\n";
document.edit.firstname.focus();
}
if( document.edit.lastname.value == "" )
{
errorMsg+= "lastname cannot be left blank.\n";
document.edit.lastname.focus();
}
if( document.edit.email.value == "" )
{
errorMsg+= "email cannot be left blank.\n";
document.edit.email.focus();
}
if( document.edit.password.value == "" )
{
alert("Hrrm");
errorMsg+= "password cannot be left blank.\n";
document.edit.password.focus();
}
if( errorMsg != "" )
{
alert(errorMsg);
return false;
}
return true;
}
code:<html>
<head><title>Edit A Account for Admins</title>
<script language ="javascript" src="../cgi-bin/java.js"></script>
</head>
<body>
<form name="edit" action="../cgi-bin/adminEdit.pl" method="post" onSubmit="return checkForm()">
<table>
<tr>
<td>Username:</td><td><input type="text" name="username" value="Raenir" /></td><br>
</tr>
<tr>
<td>Username:</td><td><input type="text" readonly="yes" name="username2" value="Raenir" /></td><br></tr>
<tr>
<td>Public Name:</td><td><input type="text" name="public_name" value="Archmagi"/></td><br>
</tr>
<tr>
<td>First Name:</td><td><input type="text" name="firstName" value="Rae"/></td><br>
</tr>
<tr>
<td>Last Name:</td><td><input type="text" name="lastName" value="Nir"/></td><br>
</tr>
<tr>
<td>Email:</td><td><input type="text" name="email" value="raenir@gmail.com"/></td><br>
</tr>
<tr>
<td>Password:</td><td><input type="text" name="password" value="dr5g0n"/></td><br>
</tr>
<tr>
<td>Location:</td><td><input type="text" name="location" value=""/></td><br>
</tr>
<tr>
<td>Homepage:</td><td><input type="text" name="homepage" value=""/></td><br>
</tr>
<tr>
<td>Occupation:</td><td><input type="text" name="occupation" value=""/></td><br>
</tr>
<tr>
<td>Interests:</td><td><input type="text" name="interests" value=""/></td><br>
</tr>
<tr>
<td>ICQ:</td><td><input type="text" name="icq_number" value=""/></td><br>
</tr>
<tr>
<td>MSN:</td><td><input type="text" name="msn" value=""/></td><br>
</tr>
</table>
<input type="submit"><br>
</form>
</html
quote:I can do so, but surely even you cannot possibly believe that the Javascript engine will?
Originally posted by Blayne Bradley:
Ignore the Try {
quote:Well so long as your "ands" and "buts" are still functional, you aren't out of options yet.
posted by Blayne:
Javascript Woes, its ignoring my ifs!