Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-16-2010, 12:49 PM   PM User | #1
free man
New to the CF scene

 
Join Date: Nov 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
free man is an unknown quantity at this point
combine 3 form values into 1

Hi,

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?
free man is offline   Reply With Quote
Old 11-16-2010, 01:07 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,033
Thanks: 197
Thanked 2,410 Times in 2,388 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
You do not give much detail, but

Code:
<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;
}

</script>

"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
Philip M is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:49 AM.


Advertisement
Log in to turn off these ads.