Aronya1
09-09-2003, 11:34 PM
I think this will be easy to answer for someone who understands.
I am working on a form. One of the data fields I want to pass to the database is a date field. I have located a script that works fine to display the date on the web page, but I'm not sure it's placed correctly in my html code. Could someone please verify this for me? I just want to be sure the data will be included in the field when the form is processed, and I don't have the cgi script yet to test it with.
Here's the relevant portion of the form code:
<td width="84%"><font size="2" face="Arial, Helvetica, sans-serif">
<input name="date" type="hidden" id="date"><SCRIPT LANGUAGE="Javascript"><!--
var aceDate=new Date()
var aceYear=aceDate.getYear()
if (aceYear < 1000)
aceYear+=1900
var aceDay=aceDate.getDay()
var aceMonth=aceDate.getMonth()+1
if (aceMonth<10)
aceMonth="0"+aceMonth
var aceDayMonth=aceDate.getDate()
if (aceDayMonth<10)
aceDayMonth="0"+aceDayMonth
document.write("<font color='000000' face='Arial' size='2'><b>"+aceMonth+"/"+aceDayMonth+"/"+aceYear+"</b></font></small>")
//--></SCRIPT>
</font></td>
So, do I have the javascript inserted in the proper place? Also, the field was originally intended to be hidden, but the date is displaying on the web page. This is not a problem, but it makes me question whether or not I'm doing this right.
Thanks in advance,
Aronya1
I am working on a form. One of the data fields I want to pass to the database is a date field. I have located a script that works fine to display the date on the web page, but I'm not sure it's placed correctly in my html code. Could someone please verify this for me? I just want to be sure the data will be included in the field when the form is processed, and I don't have the cgi script yet to test it with.
Here's the relevant portion of the form code:
<td width="84%"><font size="2" face="Arial, Helvetica, sans-serif">
<input name="date" type="hidden" id="date"><SCRIPT LANGUAGE="Javascript"><!--
var aceDate=new Date()
var aceYear=aceDate.getYear()
if (aceYear < 1000)
aceYear+=1900
var aceDay=aceDate.getDay()
var aceMonth=aceDate.getMonth()+1
if (aceMonth<10)
aceMonth="0"+aceMonth
var aceDayMonth=aceDate.getDate()
if (aceDayMonth<10)
aceDayMonth="0"+aceDayMonth
document.write("<font color='000000' face='Arial' size='2'><b>"+aceMonth+"/"+aceDayMonth+"/"+aceYear+"</b></font></small>")
//--></SCRIPT>
</font></td>
So, do I have the javascript inserted in the proper place? Also, the field was originally intended to be hidden, but the date is displaying on the web page. This is not a problem, but it makes me question whether or not I'm doing this right.
Thanks in advance,
Aronya1