that submitForm() function could be shortened to just this:

function submitForm() {
        var list = document.navOrder.list;
        document.navOrder.menuids.value = list.options.join(',');
        document.navOrder.submit;       
}

doesn't really help you, but makes things a bit clearer for debugging.

> -----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]

Reply via email to