Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Combo Box Menu from Previous Selection

Status
Not open for further replies.

cfash

Programmer
Nov 22, 2000
8
US
Hello,

Here is what I want to do and I have no idea if it is even possible.

I want to have three combo boxes on one page. One for the year, month, and day. When the page loads, the year menu will be populated. Then what I need to do is to have the user select a year. When he/she clicks the year I want to load the month table. Then they will select and click a month. This click should load the day table.

I only want them to be able to select certain options, and I thought this would be a good way. Validation would work also, but I have a feeling it would be a pain.

Does anyone know where I should start?

Chris
 
Hi.

I don't know exactly why do you want to load the months after select the year, 'cause the months are both 12 in every year. But, lets you want.

1. Create empty SELECT object on your page.(except year)

<html><body>
<SELECT name=&quot;Year&quot; id=&quot;Year&quot; size=&quot;1&quot; onchange=&quot;selMonth()&quot;>
<OPTION value=&quot;1&quot;>1975</OPTION>
.. or you can set a DataSource to get the years ...
</SELECT>

<SELECT name&quot;Month&quot; id=&quot;Month&quot; size=&quot;1&quot; onchange=&quot;selDay()&quot;></SELECT>

<SELECT name&quot;Day&quot; id=&quot;Day&quot; size=&quot;1&quot; onchange=&quot;lasSelection()&quot;></SELECT>

<Script Language=&quot;JavaScript&quot;.....

function selMonth()
{
.. an very simply example
var newOpt=document.createElement(&quot;OPTION&quot;);
newOpt.text=&quot;January&quot;;
document.all.selMonth.add(newOpt);
}

function selDay()
{ ... same as selMonth() ..... }
</script>
</body></html>

regards, Kiri
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top