Multiple select boxes not working.

This is a question I shouldn't be asking but I can't figure it out.  It used to work but now it doesn't and I don't know why.  I'm sure I didn't change anything.

Anyway, the question.  I have two select boxes with the attribute multiple.  When selecting more than one item it should return a comma delimted list of the selected options values.  All I get is the first selected item.

My code (I've left the ASP in in case that is what is causing the issue:
<select name="s1_PeopleTeam" title="Team" size="8" multiple="multiple">
<option value="">--- SELECT ---</option>
<option value="ww" <%if inStr(PeopleTeam,"ww") then response.write "selected=""selected"""%>>ww reinsurance</option>
<option value="london" <%if inStr(PeopleTeam,"london") then response.write "selected=""selected"""%>>london reinsurance</option>
<option value="property" <%if inStr(PeopleTeam,"property") then response.write "selected=""selected"""%>>property</option>
<option value="casualty" <%if inStr(PeopleTeam,"casualty") then response.write "selected=""selected"""%>>casualty</option>
<option value="compliance" <%if inStr(PeopleTeam,"compliance") then response.write "selected=""selected"""%>>compliance</option>
<option value="management" <%if inStr(PeopleTeam,"management") then response.write "selected=""selected"""%>>management</option>
<option value="finance" <%if inStr(PeopleTeam,"finance") then response.write "selected=""selected"""%>>finance</option>
<option value="claims" <%if inStr(PeopleTeam,"claims") then response.write "selected=""selected"""%>>claims</option>
<option value="reception" <%if inStr(PeopleTeam,"reception") then response.write "selected=""selected"""%>>reception</option>
</select>

<select name="s0_PeopleTeamName" title="Team" size="8" multiple="multiple">
<option value="">--- SELECT ---</option>
<option value="Managing Underwriter" <%if instr(PeopleTeamName,"Managing Underwriter") then response.write "selected=""selected"""%>>Managing Underwriter</option>
<option value="Active Underwriter" <%if instr(PeopleTeamName,"Active Underwriter") then response.write "selected=""selected"""%>>Active Underwriter</option>
<option value="Treaty Property" <%if instr(PeopleTeamName,"Treaty Property") then response.write "selected=""selected"""%>>Treaty Property</option>
<option value="Paris" <%if instr(PeopleTeamName,"Paris") then response.write "selected=""selected"""%>>Paris</option>
<option value="Cologne Euro Team" <%if instr(PeopleTeamName,"Cologne Euro Team") then response.write "selected=""selected"""%>>Cologne Euro Team</option>
<option value="Net Retained" <%if instr(PeopleTeamName,"Net Retained") then response.write "selected=""selected"""%>>Net Retained</option>
<option value="Aviation X/L" <%if instr(PeopleTeamName,"Aviation X/L") then response.write "selected=""selected"""%>>Aviation X/L</option>
<option value="LMR" <%if instr(PeopleTeamName,"LMR") then response.write "selected=""selected"""%>>LMR</option>
<option value="Space" <%if instr(PeopleTeamName,"Space") then response.write "selected=""selected"""%>>Space</option>
<option value="Personal Accident" <%if instr(PeopleTeamName,"Personal Accident") then response.write "selected=""selected"""%>>Personal Accident</option>
<option value="Contingency" <%if instr(PeopleTeamName,"Contingency") then response.write "selected=""selected"""%>>Contingency</option>
<option value="War and Terrorism" <%if instr(PeopleTeamName,"War and Terrorism") then response.write "selected=""selected"""%>>War and Terrorism</option>
<option value="Global Financial Risks" <%if instr(PeopleTeamName,"Global Financial Risks") then response.write "selected=""selected"""%>>Global Financial Risks</option>
<option value="Cargo and Specie" <%if instr(PeopleTeamName,"Cargo and Specie") then response.write "selected=""selected"""%>>Cargo and Specie</option>
<option value="Liabilities" <%if instr(PeopleTeamName,"Liabilities") then response.write "selected=""selected"""%>>Liabilities</option>
<option value="Speciality" <%if instr(PeopleTeamName,"Speciality") then response.write "selected=""selected"""%>>Speciality</option>
<option value="Excess and Primary" <%if instr(PeopleTeamName,"Excess and Primary") then response.write "selected=""selected"""%>>Excess and Primary</option>
<option value="Legal Indemnities" <%if instr(PeopleTeamName,"Legal Indemnities") then response.write "selected=""selected"""%>>Legal Indemnities</option>
<option value="Treaty Casualty" <%if instr(PeopleTeamName,"Treaty Casualty") then response.write "selected=""selected"""%>>Treaty Casualty</option>
<option value="Professional Indemnity" <%if instr(PeopleTeamName,"Professional Indemnity") then response.write "selected=""selected"""%>>Professional Indemnity</option>
<option value="Miscellaneous" <%if instr(PeopleTeamName,"Miscellaneous") then response.write "selected=""selected"""%>>Miscellaneous</option>
<option value="Reinsurance" <%if instr(PeopleTeamName,"Reinsurance") then response.write "selected=""selected"""%>>Reinsurance</option>
<option value="Financial Risks and PR" <%if instr(PeopleTeamName,"Financial Risks and PR") then response.write "selected=""selected"""%>>Financial Risks and PR</option>
<option value="Marine Liability" <%if instr(PeopleTeamName,"Marine Liability") then response.write "selected=""selected"""%>>Marine Liability</option>
<option value="Space" <%if instr(PeopleTeamName,"Space") then response.write "selected=""selected"""%>>Space</option>
<option value="Cargo and Specie" <%if instr(PeopleTeamName,"Cargo and Specie") then response.write "selected=""selected"""%>>Cargo and Specie</option>
<option value="Orphans" <%if instr(PeopleTeamName,"Orphans") then response.write "selected=""selected"""%>>Orphans</option>
</select>
LVL 10
dij8Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Magic55Commented:
0
dij8Author Commented:
I'm not using .Net.  Even before I get that far I am not getting the multiple values anyway.  I put in an alert in JavaScript before the form is posted where I thought I would get a comma separated list but all I get is the first item.
0
Magic55Commented:
a javascript function that prints out selected values ....

<script type="text/javascript">
function myFunction()
{
var sel = document.myform.elements["s1_PeopleTeam"];
var options = sel.options, k=0;
while(opt = options[k++])
{
if(opt.selected)
alert(opt.value);
}
}
</script>

The selected values are posted like this (if you use method GET)  
... url.com?s1_PeopleTeam=london&s1_PeopleTeam=property

/TK





0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Diablo84Commented:
You will need to make multiple select boxes a html array so all of the selected options are posted by adding [] after the inputs name. eg:

<select name="s1_PeopleTeam[]" ...

When you handle the data server side you then have an array to work with
0
knightEknightCommented:
try adding method="post" in your <form> tag.

0
dij8Author Commented:
I am using post.

Another project has reared its ugly head so this one will have to go on the back-burner.  I will try the array thing when I get a chance but it may be a few days.  I have other select forms where I don't use an array and they work fine.  I am sure the result is a comma separated list.  Maybe not.

Please be patient with me for this unexpected delay.
0
archrajanCommented:
you have to give selectAll function
when submitting the function have a javascript to select all the values in the multiple selectbox
then it wud work.
i have the same problem

the selectall function would be

function selectall()
{
for(i = 0; i <document.formname.selectbox.length; i++)
{
document.formname.selectbox.options[i].selected = true
}
}

just call this function
<form name = "formname" method = "post" onsubmit = "selectall();">
0
prodesign777Commented:
get rid of multiple=multiple. It's just multiple at the end of the tag. Look at the example below.

<form name="form1" method="post" action="">
  <select name="select" size="1" multiple>
    <option value="i1" selected>item 1</option>
    <option value="i2">item2</option>
    <option value="i3">item3</option>
  </select>
</form>

this will help you, just try it.
0
prodesign777Commented:
Sorry, always want to set the size value as well:

<form name="form1" method="post" action="">
  <select name="select" size="3" multiple>
    <option value="i1" selected>item 1</option>
    <option value="i2">item2</option>
    <option value="i3">item3</option>
  </select>
</form>
0
dij8Author Commented:
Thanks prodesign777.  I'll be looking into this again shortly.

The multiple attribute should have a quoted value to be compliant, although I believe it is not compulsory.  The likes of Mozilla don't like it when you don't quote attributes.  I have tried it without this and it didn't help anyway.
0
dij8Author Commented:
I haven't even looked at this in ages and the same thing has come up again in another job.  It took a while but I have a solution.

As it turns out, I didn't give you guys enough information to answer the question.  A select does in fact return a comma delimited string.  Which I can work with.  Unless of course you are using ASPUpload!  It then returns each selected item as a different form name/value pair all with the same name.  A somewhat over the top loop has given me the answer I needed.

    dim x
    for x = 1 to Upload.form.count
      if Upload.form(x).name = "s1_PeopleTeam" then
        s1_PeopleTeam = s1_PeopleTeam & "," & Upload.form(x)
      end if
    next
    s1_PeopleTeam = split(mid(s1_PeopleTeam,2),",")

I then have an array I can work with of the People Team.

Not sure yet what I'll do about this question.  I might request a PAQ in case anyone else encounters this unusual issue of using multiple selects in ASP with Persits ASPUpload (the last statement is for the benfit of the search engines).
0
Diablo84Commented:
I am not familiar with ASP but it's the same principle if you use a HTML array as i mentioned here: Q_21217125.htm#12654348

You should already have an array server side without having to use split.

0
Diablo84Commented:
0
Diablo84Commented:
ok, should have gone with "scroll up" or a self quote:

"You will need to make multiple select boxes a html array so all of the selected options are posted by adding [] after the inputs name. eg:

<select name="s1_PeopleTeam[]" ..."

Apologies to everyone subscribed for the 3 notif's in your inbox.
0
dij8Author Commented:
It's not an ASP issue.  In ASP you are returned a comma delimited list.  Maybe adding [] does it as an array instead saving the server side assignment.  But in this case it doesn't help.

This is an issue with Persits ASPUpload.  Even with [] the returned values are still a named value pair.  I go through the list of form results using the following code:
    for x = 1 to Upload.form.count
      response.write Upload.form(x).name & ":" & Upload.form(x) & "<br>"
    next

I get something like:
t1_Position:PRESIDENT/ Finance
t1_MemberName:Users name (removed result for privacy)
t0_Company:Comapany name (removed result for privacy)
t1_Address1:Address 1 (removed result for privacy)
t0_Address2:Address 2 (removed result for privacy)
t0_Address3:
n0_Phone:Ph number (removed result for privacy)
n0_Fax:Fax number (removed result for privacy)
n0_Mobile:
e0_Email:email address (removed result for privacy)
s1_PeopleTeam[]:1
s1_PeopleTeam[]:3
s1_PeopleTeam[]:4
s1_PeopleTeam[]:7
Picture:
Active:yes
x1_DisplayOrder:1
BNMSubmit:Save

Before the colon is the form field name, after the colon is the returned form field value.

It's resolved now anyway so I thought I'd help others with the solution I found.  Normally (as in when not using something like ASPUpload), Diablo84's solution would probably be the way to go.  Thank you for your input Diablo84.
0
dij8Author Commented:
Thanks Michel but I have answered my own question here.  Can you just PAQ it please.  It is a weird issue that is very specific and I think worth keeping.
0
Michel PlungjanIT ExpertCommented:
That is what I suggested
0
PAQ_ManCommented:
PAQed with points refunded (250)

PAQ_Man
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dij8Author Commented:
Thank you.

And thank you Michel for your input.  I should read the admin comments better.  Sorry if I offended you.
0
Michel PlungjanIT ExpertCommented:
No offence at all!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.