hi Christina,
you need add also ".value" to get the value
var dtmonth=document.Event.Sta
var dtday=document.Event.Start
var dtyear=document.Event.Star
var dt= (dtmonth + "/" + dtday + "/" + dtyear);
Main Topics
Browse All TopicsHi,
How would I add 3 form fields together to create one variable in javascript? I have 3 form fields: StartMonth, StartDay, StartYear and I want to create a validation in javascript but first need to combine these fields into one to create a date like: 07/19/2007.
This is the function that I need to change:
function ValidateForm(){
var dt=document.Event.txtDate
if (isDate(dt.value)==false){
dt.focus()
return false
}
return true
}
But instead of:
var dt=document.Event.txtDate
I need to comnine 3 formfields...
document.Event.StartMonth
document.Event.StartDay
document.Event.StartYear
as "var dt" fomatted like 07/19/2007.
I know this is simple but I don't know javascript very well and I know there is a guru out there who can help very quickly. Thanks in advance.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
.value will still work... as long as the option value is there.
this will work fine:
<select name="StartMonth">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
...
</select>
this would work, but .value wouldn't, you'd have to get the selected items text, not quite as easy...so do it like above.
<select name="StartMonth">
<option>01</option>
<option>02</option>
<option>03</option>
...
</select>
Business Accounts
Answer for Membership
by: ChristinaPupoPosted on 2007-07-19 at 18:02:37ID: 19527795
I have this but it's not working
rtMonth; Day; tYear;
var dtmonth=document.Event.Sta
var dtday=document.Event.Start
var dtyear=document.Event.Star
var dt= (dtmonth + "/" + dtday + "/" + dtyear);
Can anyone help?