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?
Contact form
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
MUST READ:
http://www.wysiwygwebbuilder.com/forms.html
http://www.wysiwygwebbuilder.com/form_wizard.html
Frequently Asked Questions about Forms
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
MUST READ:
http://www.wysiwygwebbuilder.com/forms.html
http://www.wysiwygwebbuilder.com/form_wizard.html
Frequently Asked Questions about Forms
Re: Contact form
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
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>