HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 21st, 2004, 11:37 AM
crispyty crispyty is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 19 crispyty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Red face HTML Form insert date

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!!

Reply With Quote
  #2  
Old October 21st, 2004, 11:48 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 15th Plane (12000 - 12499 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 12,025 Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 3 Weeks 6 Days 12 h 15 m 49 sec
Reputation Power: 628
Using ASP you can use the Date() function
Code:
<P align=left><B>Date: </B> 
<INPUT name=rcf_date type=hidden value="<%=Date()%>">
</P>

Reply With Quote
  #3  
Old October 21st, 2004, 12:18 PM
crispyty crispyty is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 19 crispyty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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:
Originally Posted by Memnoch
Using ASP you can use the Date() function
Code:
<P align=left><B>Date: </B> 
<INPUT name=rcf_date type=hidden value="<%=Date()%>">
</P>

Reply With Quote
  #4  
Old October 21st, 2004, 02:45 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 15th Plane (12000 - 12499 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 12,025 Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level)Memnoch User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 3 Weeks 6 Days 12 h 15 m 49 sec
Reputation Power: 628
Quote:
Originally Posted by crispyty
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?

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.

Reply With Quote
  #5  
Old October 23rd, 2004, 11:37 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 48th Plane (28500 - 28999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 28,838 Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)  Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 1 Day 14 h 30 m 10 sec
Reputation Power: 2389
Quote:
Originally Posted by crispyty
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!!
not html but javascript can do the trick. note, however, that user will see his own local date:
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

Reply With Quote
  #6  
Old October 23rd, 2004, 11:42 PM
swstyles swstyles is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 35 swstyles User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 5 sec
Reputation Power: 6
Send a message via AIM to swstyles
Errors running asp date(). Why would it error out?

Reply With Quote
  #7  
Old October 24th, 2004, 11:17 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 48th Plane (28500 - 28999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 28,838 Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)  Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 1 Day 14 h 30 m 10 sec
Reputation Power: 2389
try my code - it's not using ASP... what error exactly do you get? please be more specific if you want any help.

Reply With Quote
  #8  
Old October 25th, 2004, 04:14 PM
crispyty crispyty is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 19 crispyty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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:
Originally Posted by Shadow Wizard
try my code - it's not using ASP... what error exactly do you get? please be more specific if you want any help.

Reply With Quote
  #9  
Old October 26th, 2004, 02:07 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
ASP Free God 48th Plane (28500 - 28999 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 28,838 Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 21st Grade (Above 100000 Reputation Level)  Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2Folding Points: 549372 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 1 Day 14 h 30 m 10 sec
Reputation Power: 2389
the code here:
http://forums.aspfree.com/showpost.php?p=113730&postcount=5
right after the word "Code:"

Reply With Quote
  #10  
Old October 27th, 2009, 12:42 AM
blackkats4 blackkats4 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 1 blackkats4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 59 sec
Reputation Power: 0
I know this post is 5 years old... but thanks for it still being here. I really needed to get an automated time into my form.. and this did the trick. Super..... just get rid of the toGMT and it displays the time of the user... not the gmt time... Since the form is for local use that is great.

this is what I put into my form (it is an e-mail form...so I get all the info from it in an e-mail.

I changed the text to hidden so that the user does not see or change and it come through to the e-mail.

Code:
<script language="javascript">
      window.onload=function ()
      {
       var now=new Date();
       
       document.forms[document.forms.length-1].rcf_date.value = now;
      }
    </script>
    <form>
    <input type="hidden" name="rcf_date">
    </form>


URL of form: http://coldspringtx.net/Classifieds/application_form.html

info that comes in the e-mail

Code:
Date submitted Mon Oct 26 2009 23:27:32 GMT-0500 (Central Daylight Time)
Your First and Last Name
Partner First and Last Name
Present Address      All Phone numbers


Landlord/Mortgage Information
Landlord_Mortgage Co Name
Address and Phone


Emploment Information
You Employed by      Partner Employed by
Your Employers Name      Partners Employers Name
Your Employers Phone      Partners Employers Phone
Your Years with company      Partners Years with company
Your Salery per month      Partners Salery per month


Misc. Information
Number of children under 26 yr living with you
How did you hear about rental

----
Sent from: 65.163.124.173

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > HTML Form insert date


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek