Solved

Selection Box parameters

Posted on 2003-10-30
5
169 Views
Last Modified: 2010-04-01
Hi All,
 I have two selection boxes in a JSP . I pass values from one selectionbox to the other. Making the second one as the selectedBox.

when I try to retrieve the info in the servlet. I get only one value which is Highlighted.
Could someone let me know how to get all the values.
0
Comment
Question by:aarschie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 250 total points
ID: 9653964
there are two ways of doing this... before submitting the form run through each of the options and select them OR
add it to querystring:

if #2
function validateForm(whichForm) {
      var qString="";
      var whichList = whichForm.selYOURSELECT; // *** MAKE SURE TO CHANGE TO THE NAME OF YOUR SELECT BOX
      for (i=0;i<whichList.options.length;i++) {
            qString += ((i==0) ? "?" : "&") + "enrollList=" + whichList.options[i].value;
      }
      newAction = new String(whichForm.action);
      ix = newAction.lastIndexOf("?enrollList");
      if (ix == -1) {
            whichForm.action = newAction + qString;
      } else {
            whichForm.action = newAction.substring(0, ix) + qString;
      }
      return true;
}
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 9653970
and in the onsubmit of your form
<form name=Form1 action="..." method=post onsubmit="return validateForm(this);">
...
</form>
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 9653982
if #1:

function validateForm(whichForm) {
   var whichList = whichForm.selYOURSELECT; // *** MAKE SURE TO CHANGE TO THE NAME OF YOUR SELECT BOX
   for (i=0;i<whichList.options.length;i++) {
       whichList.options[i].selected = true;
   }
   return true;
}

call this the same way as above.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
getting param value 7 59
iterator example remove 8 75
nested if has else if 13 99
maven project jars 7 58
Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime is disastrous for companies and can lead to major hits on a brand, reputation, an…
Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question