HOLA!! J

 

I$B!G(Jm building a form and have twenty ranking questions with four options 
each.  I need to construct a selection box where the enduser can move the 
options up and down. The top option need to be saved with a value of 
$B!H(J1$B!I(J, second $B!H(J2$B!I(J, etc$B!D(J when the form is 
submitted.

 

BTW the answer selections which will populate the box will be variables 
provided from a query.

 

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? 

 

Thanks mucho,

Corey Kepler

 

 

<head>

<SCRIPT LANGUAGE="JavaScript">

function move(index,to) {

var list = document.form.list;

var total = list.options.length-1;

if (index == -1) return false;

if (to == +1 && index == total) return false;

if (to == -1 && index == 0) return false;

var items = new Array;

var values = new Array;

for (i = total; i >= 0; i--) {

items[i] = list.options[i].text;

values[i] = list.options[i].value;

}

for (i = total; i >= 0; i--) {

if (index == i) {

list.options[i + to] = new Option(items[i],values[i + to], 0, 1);

list.options[i] = new Option(items[i + to], values[i]);

i--;

}

else {

list.options[i] = new Option(items[i], values[i]);

   }

}

list.focus();

}

function submitForm() {

var list = document.form.list;

var theList = "?";

// start with a "?" to make it look like a real query-string

for (i = 0; i <= list.options.length-1; i++) { 

theList += "list" + list.options[i].value + "=" + list.options[i].text;

// a "&" only BETWEEN the items, so not at the end

if (i != list.options.length-1) theList += "&";

}

location.href = document.form.action + theList;

}

//  End -->

</script>

</HEAD>

 

<BODY>

 

<form method="GET" action="" name="form">

<table>

<tr>

<td align="middle">

<select name="list" size="4">

<option value="1">item-A</option>

<option value="2">item-B</option>

<option value="3">item-C</option>

<option value="4">item-D</option>

</select><br><br>

<input type="button" value="submit" onClick="submitForm()">

</td>

<td valign="top">

<input type="button" value="$B",(J" 

onClick="move(this.form.list.selectedIndex,-1)"><br><br>

<input type="button" value="$B"-(J"

onClick="move(this.form.list.selectedIndex,+1)">

</td>

</tr>

</table>

</form>

 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:317045
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to