Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Thanked 0 Times in 0 Posts

    combine 3 form values into 1


    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?

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    London, England
    Thanked 2,596 Times in 2,574 Posts
    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
    Last edited by Philip M; 11-16-2010 at 01:15 PM. Reason: Typo


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts