Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

mulitple select from drop down list

Posted on 2003-02-28
1
Medium Priority
?
166 Views
Last Modified: 2010-04-01
Hi have a drop down list of account codes & account description like:

<select name="acc" size=5 multiple>
<option value="0">ALL</option>
<option value="1">acct1 desc</option>
<option value="2">acct2 desc</option>
<option value="3">acct3 desc</option>
................
.............
..............
<option value="n">acctn desc</option>

so every thing work's fine like if user select's 3 accounts on the screen from DD list my bean will get 3 account codes for the query and i getting them in a array
and framing the query like account IN(1, 2, 3)
so if one account code is selected or more selected it works fine retrieves aqurate results.
But when user selects ALL i want to pass all the account codes from the DD list to the Bean like:
Bean Query should look like this
account IN (1,2,3,..............n) what ever is there in the Drop down list all codes should be passed to the Bean.
Any ideas , greatly appreciated.
thanx.
0
Comment
Question by:vpenta
1 Comment
 
LVL 14

Accepted Solution

by:
kennethxu earned 60 total points
ID: 8044678
there are some options that you can consider:

1. in query, the condition of "account in( everyting )" is just same as didn't specify the condition at all. so you can change you bean code to handle this situation.

2. don't include all as select option, rather put an extra "select all" checkbox right after and use javascript to select every item in the list when user check that "select all" checkbox.

3. put the how list in hidden fields and submit it together:
<input type=hidden name=allacc value="1">
<input type=hidden name=allacc value="2">
....
<input type=hidden name=allacc value="n">
then, if getParameter("acc").equals( "0" ), use getParameter( "allacc" ) instead.

4. when you populate your DD list, also store the account list(or array) in session.setAttribute() and get use session.getAttribute() to get it back if use select all.

let me know if you have futher enquires.

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Machine Learning is one of the profound applications of AI and therefore, just like AI, it is surrounded by myths and fears. Check out these facts about ML that demystify the related myths.
Use this step by step method when setting up QuickBooks Online. They will allow you to explore the various features of the advanced settings available to you.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview
Suggested Courses
Course of the Month14 days, 19 hours left to enroll

578 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