View Full Version : combine 3 form values into 1

free man
11-16-2010, 01:49 PM

I have a form where dob is generated using 3 select boxes, 1 for day, month and year. My output needs to be in the form dob=dd-mm-yyyy rather than day=dd, month=mm and year=yyyy.

It has been suggested that i do the following:

"On submit button click, use JS to create a hidden input (Q5) in the form and assign its value, then disable the day, month, and year fields so they are not submitted."

Does anyone know how to do this?

Philip M
11-16-2010, 02:07 PM
You do not give much detail, but

<script type = "text/javascript">

function reformatDOB() {
var dd = document.myform.dayselectlist.value;
var mm = document.myform.monthselectlist.value;
var yy = document.myform.yearselectlist.value;

var Q5 = dd + "-" + mm + "-" + yy;

document.formname.dayselectlist.disabled = true;
document.formname.monthselectlist.disabled = true;
document.formname.yearselectlist.disabled = true;


"Chelsea have five or six injured players out at the moment, and if Ashley Cole is injured that makes it seven or eight." - Football commentator