> I found some javascript, but am not sure how I can implement it into a
> CFFORM. I need twenty of these. Could anyone offer some advice on how
> I can either do a ranked selection box or how I might be able to
> implement this code?
The javascript is hardcoded to work with a single selected named "list". You
could modify it work with a dynamic list by giving your select lists
incremental ID's (id="list1", id="list2", ...,id="list20"). Just pass the
dynamic id's into the function, and inside the function use the ID to retrieve
the list and its properties. The rest of the code should be the same.
<!--- pass in the list id's and direction --->
<select id="list1" ...>
<input type="button" onClick="move('list1',-1)">
<input type="button" onClick="move('list1',+1)">
<select id="list2" ...>
<input type="button" onClick="move('list2',-1)">
<input type="button" onClick="move('list2',+1)">
// accepts the ID of a select list and direction: -1 or +1
function move(listID, to) {
// get the list element
var list = document.getElementById( listID );
// get currently selected position
var index = list.selectedIndex;
//.... other code
}
That said, I think the function could be improved. You do not need to loop
through all of the list elements. Just swap the selected item with the one
before or after it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:317075
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4