0

Using Classic ASP and JS. How do I return multiple values from a multi select? The code below is only returning the first value selected.

in my .asp code

<select name="month_day" multiple="multiple" size="5" id="month_day_select">

onClick="document.useredit.schedule_details.value=getDetailValue();

in my .js code

function getDetailValue() {
var sel_index=document.useredit.month_day.selectedIndex;
s_detail=document.useredit_monthday.options[sel_index].value;

return s_detail;
}
user2393602
  • 51
  • 1
  • 1
  • 3
  • Why JS, why not just `Split(Request("month_day"), ",")` and loop through the data used to build the dropdown and compare the values setting `selected` if they match? – user692942 May 24 '21 at 16:17
  • I'm modifying an old program to allow multiple values selected. The code goes through the js to do some other stuff aswell, so I don't want to mess with it too much. I need to be able to read the values selected in the .js – user2393602 May 25 '21 at 00:06
  • 2
    Does this answer your question? [How to get all selected values from – Flakes May 25 '21 at 07:02
  • You need to pass the request.form object yourself because there will be multiple variables with the same name. Your variable of month_day will be in the request.form variable as: month_day=01&month_day=02&otherdata=value&somethingelse=something .... etc.. For example, from above if you have selected month_day twice it will have the variable twice. This is a normal HTTP response, it is that classic ASP doesn't offer up an array or anything like that for form values with the same name. – silver Jun 15 '21 at 12:40

0 Answers0