J
johkar
I am in the process of editing the below code I found online, I have a
from multi-select list and a to multi-select list. Before rewriting
the to list, I want to sort it but ignore the "F - " and the "R - ".
Ideas???
F - A200000 Some Text Here
R - H205200 Some Other Text
John
function move(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var myTo=""
var arrLookup = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrLookup[tbox.options.text] = tbox.options.value;
arrTbox = tbox.options.text;
myTo += tbox.options.value;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options.text] = fbox.options.value;
if (fbox.options.selected && fbox.options.value != "" &&
myTo.indexOf(fbox.options.value) <= -1) {
arrTbox[tLength] = fbox.options.text;
tLength++;
}
else {
arrFbox[fLength] = fbox.options.text;
fLength++;
}
}
//arrFbox.sort();
arrTbox.sort();
//fbox.length = 0;
tbox.length = 0;
var c;
//for(c = 0; c < arrFbox.length; c++) {
//var no = new Option();
//no.value = arrLookup[arrFbox[c]];
//no.text = arrFbox[c];
//fbox[c] = no;
//}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
}
}
from multi-select list and a to multi-select list. Before rewriting
the to list, I want to sort it but ignore the "F - " and the "R - ".
Ideas???
F - A200000 Some Text Here
R - H205200 Some Other Text
John
function move(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var myTo=""
var arrLookup = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrLookup[tbox.options.text] = tbox.options.value;
arrTbox = tbox.options.text;
myTo += tbox.options.value;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options.text] = fbox.options.value;
if (fbox.options.selected && fbox.options.value != "" &&
myTo.indexOf(fbox.options.value) <= -1) {
arrTbox[tLength] = fbox.options.text;
tLength++;
}
else {
arrFbox[fLength] = fbox.options.text;
fLength++;
}
}
//arrFbox.sort();
arrTbox.sort();
//fbox.length = 0;
tbox.length = 0;
var c;
//for(c = 0; c < arrFbox.length; c++) {
//var no = new Option();
//no.value = arrLookup[arrFbox[c]];
//no.text = arrFbox[c];
//fbox[c] = no;
//}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
}
}