Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem after moving data between select boxes

Status
Not open for further replies.

SimonFinn

Programmer
Mar 13, 2003
130
GB
Hi guys,

I have this code that i have recieved from someone to move data between two select boxes. I am having problems retrieving the data when it is posted to an ASP page. If i dont move any data using the code i can access it. If i do click one of the buttons that executes the function the data moves and is visible in the other box.

But when i post it i cannot retrieve the data.

Has anyone got any ideas on the problem?

Thanks Si.

the code:
function moveIt(action, thisOption){
if (thisOption == -1){
return false;
}
if (action == 'add'){
c2 = document.getElementById("clients2")
c2.options[c2.options.length] = new Option (document.myForm.clients1[thisOption].text, document.myForm.clients1[thisOption].value)
c1 = document.getElementById("clients1")
c1.options[thisOption] = null
}
if (action == 'del'){
c1 = document.getElementById("clients1")
c1.options[c1.options.length] = new Option (document.myForm.clients2[thisOption].text, document.myForm.clients2[thisOption].value)
c2 = document.getElementById("clients2")
c2.options[thisOption] = null
}
}
 
Kinda hard to know when we don't know how your
submission routine runs.

In the submission routine you could run thru
the clients2 options and select them before you
submit--
Code:
function subfrm(){
 d = document.myForm.clients2;
 if(d.selectedIndex == -1){
   for(i=0;i<d.options.length;i++) {
      d.options[i].selected = true; }}
}

If that doesn't do it supply all the form elements
that apply with the next post.

2b||!2b
 
I just found out what the problem was it was only posting the selected options, so i put a function in to select them before posting.

Thanks for the post though.

Cheers Si
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top