0

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

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by FlashCreations
0

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>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.