Not sure if this is the right place to put this....

In Dreamweaver CS3 - I have created a page full of ASP fields, in a form, plus a submit button - so as to capture data into a database. It all works fine and puts data in there.

I would now like to do 2 things;

1. Default the current date and time into a field that is sent back to the database - can't work out how to do that

2. Validate the form. Reading the Help it says to highlight the Form Tag - select behaviours - and pick Validate Form ....BUT - the Validate Form option is greyed out !! I've tried selecting the form, the submit button, the Hidden Insert value etc ...but cant get at it.

Any ideas much appreciated

Phil

Javascript. You can use it's date function to put the time, etc. into the field. Create a javascript function to validate your form and the add onsubmit="return Validate(this);" to your form. The validate function can validate the form and then if valid, put the date, etc into a textbox and submit. If you need specific help with Javascript validation, please feel free to PM me.
Here is an example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>My Form</title>
<script type="text/javascript">
function Validate(form)
{
	with(form)
	{
		if(name.value==''||lang.value=='')
		{
			return(false);
		}
		else
		{
			date.value = Date();
			return(true);
		}
	}
}
</script>
</head>
<body>
<form name="form" action="myscript.asp" id="form" method="get" onsubmit="return Validate(this);">
This is an example form:<br />
Name: <input type="text" name="name" /><br />
Programming Language: <input type="test" name="lang" /><br />
<input type="hidden" name="date" value="" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.