This is a discussion on Date/Time stamp a form field as the form is submitted within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi all... Can anyone help me how can i date/time stamp a form field as the form is submitted. ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Hi all... <script language="JavaScript"> function stamp() { document.myForm.dateandtime.value = new Date(); } </script> <form name="myForm" onSubmit="stamp()"> <input type="hidden" name="dateandtime"> <input type="submit"> </form> Thanks... |
| |||
| <html> <head> <title>Get submitted date</title> <script type="text/javascript"> function addDate(form) { var day = new Date(); var submitted = (+day.getHours()+':'+day.getMinutes()); form.submitted_date.value=submitted; } </script> </head> <body> <form method="post" onSubmit="return false;"> <input type="text" name="submitted_date" value=""> <!-- rest of your form --> <input type="submit" onClick="addDate(this.form);" value="Submit"> </form> </body> </html> |
![]() |
| Thread Tools | |
| Display Modes | |
| |
LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/html-css-javascript-coding-techniques/4968-date-time-stamp-form-field-form-submitted.html | |||
| Posted By | For | Type | Date |
| DiscussWeb IT Community - Technical Support and Technology Discussions | This thread | Refback | 01-15-2008 08:42 PM |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Prefill a text form field with the current date. | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 03-18-2008 09:09 PM |
| store the current date in a hidden form field. | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 02-10-2008 09:36 PM |
| Date/time stamp a form field as the form is submitted | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 02-06-2008 10:16 PM |
| Date and time displayed in a hidden form field. | itbarota | HTML, CSS and Javascript Coding Techniques | 2 | 02-01-2008 09:47 PM |
| How can I clear the form field values after the user has submitted the form for clien | itbarota | HTML, CSS and Javascript Coding Techniques | 1 | 11-01-2007 11:39 PM |