>Oh you want to _move_ items in a DS. Hmm. Not sure if that is
>something you can do out of the box. You got me there.
>
>
>>
I have the JS code which does that
function Field_up(lst) {
var i = lst.selectedIndex;
if (i>0) Field_swap(lst,i,i-1);
}
function Field_down(lst) {
var i = lst.selectedIndex;
if (i<lst.length-1) Field_swap(lst,i+1,i);
}
function Field_swap(lst,i,j) {
var t = '';
t = lst.options[i].text; lst.options[i].text = lst.options[j].text;
lst.options[j].text = t;
t = lst.options[i].value; lst.options[i].value = lst.options[j].value;
lst.options[j].value = t;
t = lst.options[i].selected; lst.options[i].selected = lst.options[j].selected;
lst.options[j].selected = t;
t = lst.options[i].defaultSelected; lst.options[i].defaultSelected =
lst.options[j].defaultSelected; lst.options[j].defaultSelected = t;
}
function SetFields(lst,lstSave) {
var t;
lstSave.value=""
for (t=0;t<=lst.length-1;t++)
lstSave.value+=String(lst.options[t].value)+",";
if (lstSave.value.length>0)
lstSave.value=lstSave.value.slice(0,-1);
}
and then I declaring the hidden variable <input type="hidden" Name="FieldsSave">
and then do the DB update
<cfif isDefined("btnsubmit2")>
<cfset Order=1>
<cfloop list="#Form.FieldsSave#" index="field">
<cfquery name="SetOrder" datasource="HotBanana_Manager">
UPDATE trnAcademicProgramCategory
SET categorySort = #Order#
WHERE categoryId=#field# and schoolCode='#session.schoolcode#'
</cfquery>
<cfset Order = Order + 1>
</cfloop>
</cfif>
And execute the code in this manner
<form action="" method="post" enctype="multipart/form-data" name="category"
onsubmit="SetFields(document.category.programlist,document.category.FieldsSave);
">
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion is delivering applications solutions at at top companies
around the world in government. Find out how and where now
http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:291331
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4