|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have an html form and one of the fields is the current date. Is there any way to insert the current date automatically whenever the form is submitted? I am using a cgi mail_to script. Do I have to do this with javascript? Here is my code for the date field.
<P align=left><B>Date: </B> <INPUT name=rcf_date type=hidden> </P> Thanks!! ![]() |
|
#2
|
||||
|
||||
|
Using ASP you can use the Date() function
Code:
<P align=left><B>Date: </B> <INPUT name=rcf_date type=hidden value="<%=Date()%>"> </P> |
|
#3
|
|||
|
|||
|
Thanks... but..
But I have already tried asp, I kept running into errors and I just gave up on it now. There is any way to do this without asp?
Quote:
|
|
#4
|
||||
|
||||
|
Quote:
So what you are saying is because you ran into errors, you just gave up on trying to use ASP, instead of trying to resolve the errors? There isn't a way to grab the date with HTML. The code above works. If you save it into an asp page and run it in your browser, click "View", "Source" you will see that the date gets populated into the hidden field. |
|
#5
|
||||
|
||||
|
Quote:
Code:
<script language="javascript">
window.onload=function ()
{
var now=new Date();
document.forms[document.forms.length-1].rcf_date.value = now.toGMTString();
}
</script>
<form>
<input type=text name="rcf_date">
</form>
the abouve will put full date string, to see available methods of the Date object, look here: http://www.devguru.com/Technologies/ecmascript/quickref/date.html |
|
#6
|
|||
|
|||
|
Errors running asp date(). Why would it error out?
|
|
#7
|
||||
|
||||
|
try my code - it's not using ASP... what error exactly do you get? please be more specific if you want any help.
|
|
#8
|
|||
|
|||
|
Which code?
Which code are you talking about? the html form or the asp page I have? I didn't get any error using the html form, but I just can't figure out a way to make it so it would insert the date whenever the form is submitted.
Quote:
|
|
#9
|
||||
|
||||
|
the code here:
http://forums.aspfree.com/showpost.php?p=113730&postcount=5 right after the word "Code:" |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > HTML Form insert date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|