I have allowed multiple select on a listbox, and I want to pass all selected options to next page. I want to do this server side for reasons that are too complicated to get into.
The following code only gets the selected value if only one is selected.
for i=0 to lstSkills.getCount()
if lstSkills.selectedIndex > 0 then
dim skills, counter
skills = lstSkills.getText(lstSkills.selectedIndex)
session("Skills"
= skills
counter = counter + 1
end if
next
session("numSelectedSkills"
= counter
This loop loops through the listbox, looking for selected values, if selecetedIndex > 0, meaning it is selected, put in session variable. Now, I wanted to be able to make each one different so I gave it the value of i. I made this up. Obviously it doesn't work. What else should I do?
Then, using the counter, I have the following for loop on the next page, which only displays when only one was selected. Also, the session variable numSelectedSkills, which is supposed to be the number of times the if statement on the previous page was true, is always one more than the number of values in the listbox, so that's not working either. Probably a dumb logic mistake.
for i=0 to session("numSelectedSkills"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Response.Write session("Skills"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Response.Write session("numSelectedSkills"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
next
Anyways, this seems pretty convoluted, and I would greatly appreciate some assistance in sorting it out.
Thanks.
The following code only gets the selected value if only one is selected.
for i=0 to lstSkills.getCount()
if lstSkills.selectedIndex > 0 then
dim skills, counter
skills = lstSkills.getText(lstSkills.selectedIndex)
session("Skills"
counter = counter + 1
end if
next
session("numSelectedSkills"
This loop loops through the listbox, looking for selected values, if selecetedIndex > 0, meaning it is selected, put in session variable. Now, I wanted to be able to make each one different so I gave it the value of i. I made this up. Obviously it doesn't work. What else should I do?
Then, using the counter, I have the following for loop on the next page, which only displays when only one was selected. Also, the session variable numSelectedSkills, which is supposed to be the number of times the if statement on the previous page was true, is always one more than the number of values in the listbox, so that's not working either. Probably a dumb logic mistake.
for i=0 to session("numSelectedSkills"
Response.Write session("Skills"
Response.Write session("numSelectedSkills"
next
Anyways, this seems pretty convoluted, and I would greatly appreciate some assistance in sorting it out.
Thanks.