views:

22

answers:

1

So I have form with two drop down lists, the second of which is dependent on the first. For the sake of example let's say if they select "even" in the first drop down, they get 2,4 and 6 as the options in the second, correspondingly if they select "odd" in the first the second becomes 1,3,5. (defaulting to even). I've done this in javascript, and it works okay... only problem is if the user has javascript turned off neither drop down shows up.

I'd like to make a single drop down for those who don't have javascript that has the options "even 2, even 4, even 6, odd 1, odd 3, odd 5"

but of course, I don't want it to show up for those who do have javascript.

I tried googling it, but kept coming up w/ NoScript ... which is the people I want to make sure can use my form. Thanks!

A: 

Another better approach would be like this:

per default use 1 select-box (dropbown), and add a simple javascript-call which will remove the one and add the two for javascript:

$(document).ready(function() {
  $('#idOfTheSelectbox').remove();
  $('#idOfPlaceholderDiv').html('<select name="select1">...</select><select name="select2">...</select>');
});
Tobias P.