﻿// JScript File

//Place this in the form tag - onsubmit="return validate_form(this)"

function validate_form(thisform)
{
with (thisform)
    {
    if (validate_required(txtEmail,"Email must be filled out!")==false)
      {txtEmail.focus();return false}
    }
}


function validate_required(field,alerttxt)
{
with (field)
    {
    if (value==null||value=="")
      {alert(alerttxt);return false}
    else {return true}
    }
}

/*function validateForm()
{

// check name
if (document.forms[0].elements[0].value == "")
    {
    alert ("Please enter a name!");
    return false;
    }

// check password length
if (document.forms[0].elements[1].value.length < 6)
    {
    alert ("Please enter a password 
    of at least 6 characters!");
    return false;
    }
// check email address


// check age
if (isNaN(document.forms[0].elements[3].value))
    {
    alert ("Please enter a valid age!");
    return false;
    }

// check age range
if (parseInt(document.forms[0].elements[3].value) < 1 ||
parseInt(document.forms[0].elements[3].value) > 99)
    {
    alert ("Please enter a valid age!");
    return false;
    }
return true;

}*/



