Two (pulldown) lists

Giganews Newsgroups
Subject: Two (pulldown) lists
Posted by:  goog…@francoissachs.nl (Francois)
Date: 23 Oct 2003

Hi,

In my form I want people to be able to select a startingpoint (month)
and then an endingpoint (month). I can make one list with all te
possible months, and another with again all possible months, but in
that way it is possible to select (i.e.) from june2003 to
february2003.

To make that (reverse) selection impossible, the options in the second
list should change when the user selects a month in the first list.

Example:

First list (From): (last month is automaticly deleted by cgi-script)
January
February
March
April
May

Second list (To): (first month is automaticly deleted by cgi-script)
February
March
April
May
June

The user selects 'March' in the first list.
The only options in the second list should be:
April
May
June

Can anyone tell me how to do this? I think a javascript would be best
for this...
PS If neccessary, the cgi-script to delete the first month of the
second list is ajustable.

The code I have now:

From:
<select name="form_period_begin" id="form_period_begin">
  <option value='101>2003' selected>jan03</option>
  <option value='102>2003'>feb03</option>
  <option value='103>2003'>mrc03</option>
  <option value='104>2003'>apr03</option>
  <option value='105>2003'>may03</option>
</select><br>

To:
<select name="form_period_end" id="form_period_end">
  <option value='102>2003'>feb03</option>
  <option value='103>2003'>mrc03</option>
  <option value='104>2003'>apr03</option>
  <option value='105>2003'>may03</option>
  <option value='106>2003' selected>jun03</option>
</select>

Replies