[thelist] Using JS to change hidden date value in Netscape?

Bob Haroche bharoche at usa.net
Fri Feb 15 18:45:01 CST 2002

I'm trying to use javascript to change the default value of a hidden field
in a form to be the date on the user's computer and then pass that value to
a cgi form processor. This is working in IE and NN 6 but not NN 4.

Note that if the form field is changed from type="hidden" to type="input",
everything works fine and NN correctly changes the value and that value is
passed to the form.  However, if the field is type="hidden", the field value
is processed as the default, un-changed value.

Is it that NN can't/won't change the value of a hidden field or is something
in my coding off?




Here's the script:

<script language="JavaScript" type="text/javascript">
// Get date, month and year
today=new Date();
// Convert Month to 12 unit measure
month=(jsmonth + 1).toString();
// Output month in two digits
  if (month.length != 2) {
 month="0" + month  }
// Output year in two digits
// Output date in YYMMDD format
 todayDate=(year + month + day);

Here's the form field:

<input type="hidden" name="dateSubscribe" value="020104">

After the closing form tag, here's how I change the default value of this

<script language="JavaScript" type="text/javascript">

More information about the thelist mailing list