Contact form

Issues related to forms.
Post Reply
tccieslak
 
 
Posts: 3
Joined: Fri Feb 28, 2020 7:40 pm

Contact form

Post by tccieslak »

I want to have a form where one of the fields sent back to the server has the current date and time in. I do not want to have the user have to enter the date and time or even select the date and time from a calendar widget, I just want to have the date and time put in the field and sent on either as a displayed field or hidden field. I looked at the prebuilt JAVA routines for date and time but they just place the information as text on the web page but not within a control field. I have set up an Editbox and tried using all three Type attributes for Date, DateTime and DateTime Local but these make the user have to pick a date and also, sometimes the date shown is not the current date but some old date which makes no sense. I have also tried Javascript to insert a date into an Editbox field on the form such as:
<script>
function dateToday() {
var d = new Date();
f = this.getField("Editbox5");
f.value = d;
}</script>
dateToday();
Nothing seems to work. Why doesn't the WYSIWYG have a simple way to insert the date and time?
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Contact form

Post by Pablo »

There is no standard option for this because no one has ever asked for this before, so it's not a common request.

Your code does not work because it's not valid.
This may work when placed at the end of the page

Code: Select all

<script>
function dateToday() 
{
   var d = new Date();
   f = document.getElementById("Editbox5");
   f.value = d;
}
dateToday();
</script>
Post Reply