[thelist] Javascript Code broke?

Tom Dell'Aringa pixelmech at yahoo.com
Thu May 20 12:12:09 CDT 2004

--- Rob Smith <rob.smith at THERMON.com> wrote:
> > if (*document.*AddProject.ProjectName.value == "") {
> I've never seen the asterisks thing before. 

He was using the * to make you see the change he made.

> Tom. I tried the var definition you suggested and immediately threw
> an error. 

You must have done something wrong. GET or POST is irrelevant. Code
posted below, tested and works. Basically you simply need to brush up
on some basic JS syntax. Make sure your variables are defined. Use
the forms and elements array. Excessive shortcutting gets you in
trouble and is not good readable code.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
function validate() 
	var AddProject = document.forms['AddProject'];
	var ProjectName =
	if (ProjectName.value == "")
		alert("You must enter a Project Name.");
		return false;
		return true;


<form action="actions/add.asp" name="AddProject" method="get" >
<input type="text" name="ProjectName" value="" />
<input type="button" value="Save" onclick="validate()">


http://www.Pixelmech.com/ - read my latest blog posting!
http://www.crossandthrone.com/ - Eternal Life

John 3:16

More information about the thelist mailing list