Forum Moderators: open

Message Too Old, No Replies

The <select> tag

Putting constraints on <select>'s

         

karen_pope

3:45 pm on Apr 8, 2002 (gmt 0)



Is it possible to force the constraint of choosing a value within <select>, therefore stopping the same value being chosen more than once.

Therefore if i had a question comparing Soup to a Sandwich and they needed to be put in a rank of importance of 1 to 5 with the use of a select element, obviously two things can not have the same value. Therefore how do i make sure that this doesnt happen.

My code looks like the following:
<select name="Q1">
<option value=""></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>Soup</select
<br>
<select name="Q1Part2">
<option value=""></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>Sandwich</select>

Any help is much appreciated!
Kaz

pcguru333

3:56 pm on Apr 8, 2002 (gmt 0)

10+ Year Member



What about creating a form that uses radio buttons? Would that work for what you are trying to do?

txbakers

4:34 pm on Apr 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could do this with a heavy dose of javascript. Generate the first select with all the options.

Then, using an onChange method, generate the second one without the first's option. It's rather tricky, but it can be done.

I saw a very nice list box that allows the user to select from the left and move to the right. Would something like that be useful?

karen_pope

8:42 am on Apr 9, 2002 (gmt 0)



That could be very useful. Could i please have a look at that!

Thanks for all your help!
Kaz