Link to home
Start Free TrialLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

Script to concatenate date and time into a hidden field

I am trying to use a script that concatenates a date field and a time field.

page1: Has the form that posts to page2.

page1 has a start date and start time as well as an end date and end time. It should put date and time together into a hidden field and then post the data.  In this demo I post it to page 2 but it will ultimately be inserted into a database.

Attached is the code for both pages. Any help is appreciated. As of now the values come up blank.
example.txt
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Aleks

ASKER

I used your script but still comes up blank. they are just fields, you can check the code I attached. no drop down menus.
Avatar of Aleks

ASKER

I see ... in the previous page I used a drop down for the  'starttime', on this page its a simple text field.
Avatar of Aleks

ASKER

I did this and it works now  :)

  <script language="javascript" type="text/javascript">
 <!--
 function putDateInHiddenField() {
  var text = document.form1.startdate;
  var hidden = document.form1.startdatecomp;
  var d = document.form1.startime;
  hidden.value = "";
  hidden.value += text.value + " " + d.value;
 }
 -->
 </script>

Thanks !