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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prioritizing Listbox selections.

Status
Not open for further replies.

RSQUARE

IS-IT--Management
May 3, 2004
5
US
Hello,
I have a list of choices in my page in form of Multiselect Listbox. The user can select a maximum of 3 from the list box. Now, it needs to be changed in according to the following.

The user must be able to select from the list and should be able to prioritize his choices. Instead of simply selecting three or less choices, he must be able to prioritize like Choice1 - NewYork; Choice2-Virginia; and Choice3-California.

Can anyone tell me what is the best strategy for this ?

Thanks in advance.
RR.
 
There is no way to "prioritize" just inside one element so I guess you'll have to create three more controls and "feed" the data form the select. Here is what I mean (just paste the code and see. the design is ugly, but you should get an idea):

Code:
<html>
<head>
<script>
function c1(){document.form1.choice1.value = document.form1.sel1.value;}
function c2(){document.form1.choice2.value = document.form1.sel1.value;}
function c3(){document.form1.choice3.value = document.form1.sel1.value;}
</script>
</head>
<body>
<form name=&quot;form1&quot;>
<table><tr>
<td>
<select name=&quot;sel1&quot; size=&quot;3&quot;>
<option value=&quot;opt1&quot;>option1</option>
<option value=&quot;opt2&quot;>opt2</option>
<option value=&quot;opt3&quot;>opt3</option>
<option value=&quot;opt4&quot;>opt4</option>
<option value=&quot;opt5&quot;>opt5</option>
</select><br>
<input type=&quot;submit&quot; name=&quot;sub1&quot; value=&quot;send&quot;>
</td>
<td>
1. <input type=&quot;button&quot; name=&quot;b1&quot; value=&quot;&gt;&gt;&quot; onclick=&quot;c1()&quot;><input type=&quot;text&quot; readonly name=&quot;choice1&quot; size=&quot;5&quot;><br>
2. <input type=&quot;button&quot; name=&quot;b2&quot; value=&quot;&gt;&gt;&quot; onclick=&quot;c2()&quot;><input type=&quot;text&quot; readonly name=&quot;choice2&quot; size=&quot;5&quot;><br>
3. <input type=&quot;button&quot; name=&quot;b3&quot; value=&quot;&gt;&gt;&quot; onclick=&quot;c3()&quot;><input type=&quot;text&quot; readonly name=&quot;choice3&quot; size=&quot;5&quot;><br>
</td>
</tr>
</table>
</form>
</body>
</html>

I hope this helped. ---
---
 
Neat idea. Thank you for understanding the problem. And Thank you for the design. This is a real neat idea. Meanwhile, please let me know if you come across any other design for this problem.

Thank you once again.


RR.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top