hello - I am trying to simplify a date picking function for a calendar application I am building. I have a form that gets submitted to a database and previously I was making users type the date of the program they were entering using a format that the database could use (YYYY-MM-DD).

I thought I could make things easier on them, if not me, by using pulldowns for the date elements. The idea would be that they could pick the year, the month, and the day off the pulldowns and I'd have some javascript that would bring it together and format the date in YYY-MM-DD format.

So, what I have come up with is as follows. When they select the day, it calls the checkdate() function. In this function:

function checkdate()
var year_val = window.document.content_ui.year.selectedIndex;
var year_select = window.document.content_ui.year.options[year_val].value;
var month_val = window.document.content_ui.month.selectedIndex;
var month_select = window.document.content_ui.month.options[month_val].value;
var day_val = window.document.content_ui.day.selectedIndex;
var day_select = window.document.content_ui.day.options[day_val].value;
window.document.content_ui.scheduled.value = year_select ?this is where I'm having problems? ;

I can get it so it writes the year in there, but even then, that only works when they first make selections of the other two. This is not so much a problem, as the larger problem of being able to make window.document.content_ui.scheduled.value = year_select - month_select - day_select;

I just want to make the 'scheduled' input box have something like 2001-12-29. So I have to somehow string the values of year_select month_select and day_select together with hyphens in between.

Anyone know how to do this? General susggestions on how to improve the code also very, very welcome. Thanks.