[thelist] JavaScript problem

Gillespie, Bryan Bryan.Gillespie at medic.com
Tue Dec 19 11:30:55 CST 2000


Greetings, Evoltians...

I've got a JavaScript Problem.  In IE 5+ and NN 4+, the script works fine.
However, in IE4, I get an error:

Line1
Char 1
Error Invalid Character
Code 0


The script is being called from an external file and it's purpose is to do
some client-side form validation.  The function EmVal() is  called from the
OnSubmit of the Form name="Tiger".

Here are the entire contents of that file:

function EmVal() {
	
	var FNameStr = String(document.Tiger.FName.value);
	var LNameStr = String(document.Tiger.LName.value);
	var TitleStr = String(document.Tiger.Title.value);
	var PracNameStr = String(document.Tiger.PracName.value);
	var Add1Str = String(document.Tiger.Add1.value);
	var Add2Str = String(document.Tiger.Add2.value);
	var CityStr = String(document.Tiger.City.value);
	var StStr = String(document.Tiger.State.value);
	var ZipStr = String(document.Tiger.Zip.value);
	var PhAreaStr = String(document.Tiger.PhArea.value);
	var PhNumStr = String(document.Tiger.PhNum.value);
	var PhExtStr = String(document.Tiger.PhExt.value);
	var SpecStr = String(document.Tiger.Spec.value);	
	var EmailStr = String(document.Tiger.Email.value);
	var CustStr = String(document.Tiger.Cust.value);
	var SystemStr = String(document.Tiger.System.value);
	var OrgStr = String(document.Tiger.Org.value);
	var NoPhysStr = String(document.Tiger.NoPhys.value);
	var WhenStr = String(document.Tiger.When.value);
	var BudgetStr = String(document.Tiger.Budget.value);

	//Check if anything is entered
	
	if (document.Tiger.FName.value.length == 0)
	{
		alert("Please provide your name.");
		document.Tiger.FName.focus();
		return false;
	}
	if (document.Tiger.LName.value.length == 0)
	{
		alert("Please provide your full name.");
		document.Tiger.LName.focus();
		return false;
	}
	if (document.Tiger.Title.value.length == 0)
	{
		alert("Please include your title.");
		document.Tiger.Title.focus();
		return false;
	}
	if (document.Tiger.PracName.value.length == 0)
	{
		alert("Please include your Practice Name.");
		document.Tiger.PracName.focus();
		return false;
	}
	if (document.Tiger.Add1.value.length == 0)
	{
		alert("Please include your address.");
		document.Tiger.Add1.focus();
		return false;
	}
	if (document.Tiger.City.value.length == 0)
	{
		alert("Please include your city.");
		document.Tiger.City.focus();
		return false;
	}
	if (document.Tiger.State.value.length == 0)
	{
		alert("Please include your state.");
		document.Tiger.State.focus();
		return false;
	}
	if (document.Tiger.Zip.value.length == 0)
	{
		alert("Please include your ZIP code.");
		document.Tiger.Zip.focus();
		return false;
	}
	if (document.Tiger.PhArea.value.length == 0)
	{
		alert("Please include your area code.");
		document.Tiger.PhArea.focus();
		return false;
	}
	if (document.Tiger.PhNum.value.length == 0)
	{
		alert("Please include your phone number.");
		document.Tiger.PhNum.focus();
		return false;
	}
		if (document.Tiger.NoPhys.value.length == 0)
	{
		alert("Please include the number of physicians at your
practice.");
		document.Tiger.NoPhys.focus();
		return false;
	}
	if (document.Tiger.Spec.value.length ==0)
	{
		alert("Please indicate your practice specialty.");
		document.Tiger.Spec.focus();
		return false;
	}
	function getRadio(radio_array)
	{
        var i;
        for (i = 0; i < radio_array . length; ++ i)
			if (radio_array [i] . checked)
				return radio_array [i] . value;
        return null;
	}
	Customer = getRadio(document.Tiger.Cust);
	if (Customer == null)
	{
		alert("Please signify if you are a customer.");
		return false;
	}
	if (Customer == "Y")
	{if (document.Tiger.System.value.length == 0)
		{
			alert("Please choose the System you currently are
using.");
			document.Tiger.System.focus();
			return false;
		}
	}
	if (document.Tiger.Org.value.length == 0)
	{
		alert("Please choose the best description of your
organization.");
		return false;
	}
	if (document.Tiger.When.value.length == 0)
	{
		alert("Please tell us when you plan to purchase a system.");
		return false;
	}
	if (document.Tiger.Budget.value.length == 0)
	{
		alert("Please indicate your budget for this purchase.");
		return false;
	}
	
	//Check for '@' and a '.' in email field
	if (document.Tiger.Email.value.length != 0)
	{
		if ((document.Tiger.Email.value.indexOf("@") < 0) ||
(document.Tiger.Email.value.indexOf(".") < 0) ||
((document.Tiger.Email.value.length <=6) &&
(document.Tiger.Email.value.length >0)))
		{
			alert("The email address is not valid.  Check the
address and re-enter");
			document.Tiger.Email.focus();
			return false;
		}
		return true;
	}
}




More information about the thelist mailing list