ASP Forum
Missing a step in validation process
akbiro | Posted 6:32am 8. July 2009 Server Time |

Could someone that is better than me take a look at this script and tell me what I am missing...probably something very small.

This script is suppose to check for information, if not found, display the alert, the user acknowledges and closes the alert, and it should return the user to that empty field.  

What it is doing is, one the alert is closed, it processes the script as if it was completed.  

Can someone take a look and tell me what I am missing?  My eyes are watering from looking at this silly thing!

<script ID="clientEventHandlersJS" LANGUAGE="javascript">

function imgSub_onclick()
{
var nReturn = 0;

  if (document.reqinfo.account_name.value.length == 0)
  {
    alert("Please enter your Business Account Sign-on Name, thank you.");
document.reqinfo.account_name.focus();
document.reqinfo.account_name.select();
    nReturn = -1;
  }
if (nReturn == 0)
{
if (document.reqinfo.file_room.value.length == 0)
{
  alert("Enter the file room for this security request, thank you.");
document.reqinfo.file_room.focus();
document.reqinfo.file_room.select();
  nReturn = -1;
}
}
if (nReturn == 0)
{
if (document.reqinfo.admin_password.value.length == 0)
{
  alert("Enter the Administrator's password, thank you.");
document.reqinfo.admin_password.focus();
document.reqinfo.admin_password.select();
  nReturn = -1;
}
}
if (nReturn == 0)
{
if (document.reqinfo.email.value.length == 0)
{
  alert("Enter the email address for the System Administrator, thank you.");
document.reqinfo.email.focus();
document.reqinfo.email.select();
  nReturn = -1;
}
}

if (nReturn == 0)
{
if (document.reqinfo.user_full_name.value.length == 0)
{
  alert("Please enter the user's first and last name, thank you.");
document.reqinfo.user_full_name.focus();
document.reqinfo.user_full_ame.select();
  nReturn = -1;
}
}

if (nReturn == 0)
{
if (document.reqinfo.security_action_1.value.length == 0)
{
  alert("Please select the security action for this user, thank you.");
document.reqinfo.security_action.focus();
document.reqinfo.security_action.select();
  nReturn = -1;
}
}
if (nReturn == 0)
{
if (document.reqinfo.user_name.value.length == 0)
{
  alert("Enter the User/ID security name, thank you.");
document.reqinfo.user_name.focus();
document.reqinfo.user_name.select();
  nReturn = -1;
}
}
if (nReturn == 0)
{
if (document.reqinfo.user_password.value.length == 0)
{
  alert("Enter the Security password for this user, thank you.");
document.reqinfo.user_password.focus();
document.reqinfo.user_password.select();
  nReturn = -1;
}

}
if (nReturn == 0) {
window.reqinfo.hidAction.value = "S";
window.reqinfo.submit();
}

}
</script>

<script LANGUAGE="JavaScript">
function SetFocus() {
document.reqinfo.account_name.focus();
document.reqinfo.account_name.select();
}

</script>


Reply to Post Missing a step in validation process



Back to Forum Page