Click to See Complete Forum and Search --> : select box problem


pelegk1
06-23-2003, 01:53 AM
i have two select box like this :
<select name="exists" size="5" multiple class=mform onChange="document.all.s3.style.display='inline';" style="width:140" onDblClick="changeLists(exists,BranchesSelector)">

<select name="exists1" size="5" multiple class=mform onChange="document.all.s3.style.display='inline';" style="width:140" onDblClick="changeLists(exists,BranchesSelector)">

if a line is chossen in the first box and being double cliked its being moved t the other box using the function changeLists(exists,exists1)

when i do it like this everything is ok!

in my page when a user returns to the page i read all the data from a cookie and update all boxes that is neededto do so!

but when i reach to update this 2 select box ,and i update like this using aloop:

for ( i = 0 ; i < tmpBranchSelectorList.length && count<=tmpBranchSelectorList.length/2 ; ++i ) {



if (parseInt(tmpBranchSelectorList.substring(startIndex,endIndex))>=0 && tmpBranchSelectorList.substring(startIndex,endIndex).indexOf(",",0)==-1) {
alert("H: "+parseInt(tmpBranchSelectorList.substring(startIndex,endIndex)));
document.F1.exists.focus()
document.F1.exists.selectedIndex=parseInt(tmpBranchSelectorList.substring(startIndex,endIndex));
document.F1.exists.focus()
changeLists(document.F1.exists,document.F1.exists); //*******

} else break;

startIndex=endIndex+1;
endIndex=tmpBranchSelectorList.indexOf(",",startIndex+1);
count++;

}


in the line //******* i do the change!
but what happens its being updated only fo the irst time and go out!!!!
i thought i hade a problm and when i put the //******* line in a comment i saw the loop run'on all the selected indexes
but when i uncomment i suddenly works only on the first index (i) and dont continue!!!!
why is that?
thanks in advance
Peleg

pelegk1
06-23-2003, 07:10 AM
first of all in c++ it's more correct to write ++i then i++
beacuse it avoid's an un nedded class construction!!!!
second

the correct line is
changeLists(document.F1.exists,document.F1.exists1);
and it still isn't working