Auto Date Field

F

frank

I have a form people can fill out & send to my email.
I'd like a field that auto fills with the date and time.
Then when I send a confirmation page back I want to
inlude that date/time field in the confirmation.

1. How do I insert that auto date field in the form
2. What is the field name I refer to in the confirmation
page?

Thanks for any help
Frank
 
J

Jim Buyens

-----Original Message-----
I have a form people can fill out & send to my email.
I'd like a field that auto fills with the date and time.
Then when I send a confirmation page back I want to
inlude that date/time field in the confirmation.

1. How do I insert that auto date field in the form
2. What is the field name I refer to in the
confirmation page?

Here's a simple example:

<html>

<head>
<title>Initialize Date Box</title>
<script>
function loadDateField(){
if (document.forms[0].txtDate.value != "") return;
curDte = new Date();
document.forms[0].txtDate.value =
(curDte.getMonth() + 1) + "/" +
curDte.getDate() + "/" +
curDte.getYear();
}
</script>
</head>

<body onload="loadDateField();">

<form method="POST">
<table border="0" cellspacing="1" id="table1">
<tr>
<td>Month</td>
<td><input type="text" name="txtDate"
size="10"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="Submit"
name="btnSub"></td>
</tr>
</table>
</form>
</body>
</html>

The onload= attribute in the <body> tag runs the script
function loadDateField().

loadDateField() checks to make sure the visitor hasn't
entered a date yet, then gets the curent date and fills
in the text box.

In the form submission and in the confirmation page, you
would access the value of the txtDate text box as you
would any other.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
Top