Solved

Selection Box parameters

Posted on 2003-10-30
5
166 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

With the rapid rise in mobile usage, mobile devices are here to stay and have become an integral part of doing business. Here are 9 great apps for your BYOD environment.
An analysis of the phishing scam that has been affecting Google users, along with steps to take for protection, as well as what to do if you receive one of the emails.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

896 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now