Dave there is no point reordering the hidden field every time you change the select list, your only doing it so u can submit the order aren't you ? SO just dump the select list into hidden field at the end when the form is submitted.
Russ Michaels Macromedia/Allaire Certified ColdFusion Developer CFDeveloper The free resource and community for ColdFusion developer. http://www.cfdeveloper.co.uk Join the CFDeveloper discussion lists. To subscribe send an e-mail to [EMAIL PROTECTED] > -----Original Message----- > From: Dave Phipps [mailto:[EMAIL PROTECTED] > Sent: 29 September 2003 14:09 > To: ColdFusion User group > Subject: [ cf-dev ] Select Box Reorder > > > Hi, > > I have the following javascript which basically allows a > select list to be > reordered. The original JS place the reordered list into a > query string > but I want to place it into a hidden form field. I can get > the hidden > field to populate but it never changes the order when then > select box is > changed: > > <SCRIPT LANGUAGE="JavaScript"> > <!-- Begin > function move(index,to) { > var list = document.navOrder.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.navOrder.list; > var menuids = ""; > var theList = ""; > for (i = 0; i <= list.options.length-1; i++) { > theList += list.options[i].value; > menuids += list.options[i].value; > // a "," only BETWEEN the items, so not at the end > if (i != list.options.length-1) theList += ","; > if (i != list.options.length-1) menuids += ","; > } > document.navOrder.menuids.value = menuids; > document.navOrder.submit(); } // End --> </script> > > Anyone help with getting the reorder list into a hidden field? > > Cheers > > Dave > > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] For human help, e-mail: > [EMAIL PROTECTED] > > -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
