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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting multiple values from listbox-URGENT!!

Status
Not open for further replies.

mmaz

Programmer
Nov 22, 2000
347
Hi! I have a listbox where the user can select multiple values. I wrote a function in Javascript that's called on Submit. I want to get the values selected by the user.

This doesn't work, any ideas?

myClientID = document.frmParameters.lstClient.value;
intLength = document.frmParameters.lstClient.length;

for (i=0;i < intLength;i++) {

if (document.frmParameters.lstClient.options(i).selected) {

myString = myString + myClientID;

}

}

My problem is, the value of myClientID doesn't change even though i is incremented. Help!

Thanks a bunch!

Marie :)

 
Make sure u have used correct cases and names for form and list box. javascript is case sensitive.

2nd for getting all selected value, my guess is, you need not to write for loop. myClientID should have all the values selected seperated by delimiter. Check value of myClientID before loop and see what you have.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top