User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 429,912 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,408 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 10664 | Replies: 1
Reply
Join Date: May 2006
Posts: 1
Reputation: JoeMDOH is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
JoeMDOH JoeMDOH is offline Offline
Newbie Poster

Multiple Select List Handling

  #1  
May 25th, 2006
On Page One of my application, I have a dropdown list that populated by a SQL query. The list displays the "Text" of the items on the list, but the values (that will be passed are the indexes from the database table) .

The user can select multiple items from the list which is then passed to Page Two, where I want to display the "Text" of the item(s) selected.

The issue is, that the selected value(s) from the list is/are the index number of the selected item.... (e.g. 1 = Item1, 2=Item2, 3=Item3) so that the results of the selection would most probably be passing (1,2,3).

To display the text, I would think that I would have to create a method that would iterate through an (Array?) and execute a SQL statement or statments that would retrieve the appropriate "Text" for the submitted values, from the database table.

I am certain that I am not the first to do this... is there any code examples that anyone would be willing to share... or are there other questions.... Would appreciate any or all help !

Thanks !!!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2007
Posts: 83
Reputation: rgtaylor is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 2
rgtaylor rgtaylor is offline Offline
Junior Poster in Training

Re: Multiple Select List Handling

  #2  
Mar 15th, 2007
I know this is an old question, but I just saw this, an in case anyone else wonders, I did domething like this several years ago, but rather than querying the db from page2, I made my values contain BOTH the index from the DB and the text... I just broke the strings up on page 2 to use the text for display and the index numbers later, or behind the scenes in the code...

This saves the overhead of going back to the DB to find the text yet again...


Originally Posted by JoeMDOH View Post
On Page One of my application, I have a dropdown list that populated by a SQL query. The list displays the "Text" of the items on the list, but the values (that will be passed are the indexes from the database table) .

The user can select multiple items from the list which is then passed to Page Two, where I want to display the "Text" of the item(s) selected.

The issue is, that the selected value(s) from the list is/are the index number of the selected item.... (e.g. 1 = Item1, 2=Item2, 3=Item3) so that the results of the selection would most probably be passing (1,2,3).

To display the text, I would think that I would have to create a method that would iterate through an (Array?) and execute a SQL statement or statments that would retrieve the appropriate "Text" for the submitted values, from the database table.

I am certain that I am not the first to do this... is there any code examples that anyone would be willing to share... or are there other questions.... Would appreciate any or all help !

Thanks !!!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JSP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JSP Forum

All times are GMT -4. The time now is 9:52 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC