mulitple select from drop down list

Posted on 2003-02-28
Medium Priority
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.
Question by:vpenta
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
1 Comment
LVL 14

Accepted Solution

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.


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The well known Cerber ransomware continues to spread this summer through spear phishing email campaigns targeting enterprises. Learn how it easily bypasses traditional defenses - and what you can do to protect your data.
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 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