Solved

Selection Box parameters

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

706 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

16 Experts available now in Live!

Get 1:1 Help Now