JavaScript error

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

JavaScript error

Post by C_Calav »

hi guys, this script WAS working last time i checked and now is not. i cant recall modifying it or anything but this is what i have.

error in dreamweaver is:

object expected line 45 which is the Email() function just below here.

when run through the internet just skips over the javascript. hmmmm?

thanx

Code: Select all

var errormessage = "" 

function validate_form()
{
        errormessage = "You have the following errors:\n"
        
	FirstName()
	LastName()
	Address()
	City()
	Country()
    Email()
	Choice1()
	Choice2()
	
	if (errormessage == "You have the following errors:\n")
	{
	   return (true);	
	}
	else
	{
	   alert(errormessage)
       return (false);
    }
}

function FirstName()
{
	var first = window.document.free_plane.F_First.value
	if (first == "")
	{
		errormessage = errormessage + "- Please enter your first name\n"
	}
}

function LastName()
{
	var last = window.document.free_plane.F_Last.value
	if (last == "")
	{
		errormessage = errormessage + "- Please enter your last name\n"
	}
}

function Address()
{
	var address = window.document.free_plane.F_Address1.value
	if (address == "")
	{
		errormessage = errormessage + "- Please enter your address\n"
	}
}

function City()
{
	var city = window.document.free_plane.F_City.value
	if (city == "")
	{
		errormessage = errormessage + "- Please enter your town/city\n"
	}
}

function Country()
{
	var country = window.document.free_plane.F_Country.optionsїwindow.document.free_plane.F_Country.selectedIndex].value
	if (country == "Select your County")
	{
		errormessage = errormessage + "- Please enter your country\n"
	}
}

function Email()
{
	var email = window.document.free_plane.F_Email.value	
	if (email == "")
	{
		errormessage = errormessage + "- Please enter your email\n"
	}
	else if (email.indexOf("@")==-1)
	{
		errormessage = errormessage + "- Your e-mail is not a valid e-mail\n"
	}
	
function Choice1()
{
	var choice1 = window.document.free_plane.F_Choice1.value	
	if (choice1 == "")
	{
		errormessage = errormessage + "- Please enter plane choice 1\n"
	}	
}

function Choice2()
{
	var choice2 = window.document.free_plane.F_Choice2.value	
	if (choice2 == "")
	{
		errormessage = errormessage + "- Please enter plane choice 2\n"
	}	
}	
	
	
}
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Email() has Choice1() and Choice2() inside it's code.
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Post by C_Calav »

ah, thanx feyd
Post Reply