?
Solved

getting values from a listbox

Posted on 2003-02-26
14
Medium Priority
?
212 Views
Last Modified: 2010-04-06
I have a listbox and am wondering if it's possible to retrieve all the listed items (doesn't matter whether they are selected or not) and be able to manipulate them using jsp. For me, I am trying to add the items in an access database...

Any suggestiong will be appreciated :D
0
Comment
Question by:newbieME
[X]
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
  • 5
  • 2
  • 2
  • +4
14 Comments
 
LVL 17

Accepted Solution

by:
dorward earned 80 total points
ID: 8026117
Assuming you mean a <select> element:

No, only selected items will be submited.

Generally the easiest way to handle it is to generate the HTML for the <select> from a database, then get the same data from the database when you want to know all the elements in the <select> element.
0
 

Author Comment

by:newbieME
ID: 8026306
oh that's no good..i am using the listbox dynamically...so the items are going to be different when it comes time to submit....oy
0
 

Author Comment

by:newbieME
ID: 8026399
no other way?? :|
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:dorward
ID: 8027416
I suppose you could create a new input of type hidden when you add the data to the <select>.

Personally, I wouldn't make a site so dependant on client side code.
0
 

Author Comment

by:newbieME
ID: 8028111
yeah nevermind..i got it figured out...though it's not very efficient i can't seem to find any other way to do it....if anyone is having the same problem as i am tell me and i will post the code
0
 
LVL 4

Expert Comment

by:Wakie
ID: 8030802
>> i am using the listbox dynamically <<

I would imagine you accomplish this from a database?

If it's already in a database, why do you want to reinsert it?
0
 

Author Comment

by:newbieME
ID: 8034526
I am going to get this question to be removed and if there are no objections :D
0
 
LVL 14

Expert Comment

by:Esopo
ID: 8045694

Excuse me...

>> i am using the listbox dynamically <<
means you are adding items to the list at the client side, depending on the user's input?

If so, I would recommend you use JavaScript to add all the values to a hidden input when the form is about to be sent.

If you need code for this I can provide.

Best regards.

0
 

Author Comment

by:newbieME
ID: 8049426
yeah that's exactly what i did :D
0
 

Expert Comment

by:matrix0510
ID: 8056565
The only way to do it i beleive.... is concatenate all the values in a hidden variable b4 submitting using comma separators and then access those in jsp and u can separete using substring function...

regards
0
 
LVL 14

Expert Comment

by:Esopo
ID: 8061466
That's exactly what I am thinking, I can think of a couple more ways to do it, but that's pretty much what I'm suggesting.

Although comma separation might be conflictive depending on what information are you trying to send.

For instance, if you are using single words or numeric values, comma separation would be a good way to go, but if your information has user's descriptions or comments, then those comments may include commas themselves, you would be better off using a different separator like 'Ç' (chr 128) or '%%%'.

Then at the ASP processing of the hidden field, you could use something like


Array1=Split(HiddenField, 'Ç')  
'VBScript, I'm not sure if ASP supports Split, but you get the picture


to separate the values into an array (use Ubound(Array1) to check for the last item).

Best regards.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9115203
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9306222
It is time to clean this abandoned question up.

I am putting it on a clean up list for CS.

<recommendation>
points to dorward

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&

0
 
LVL 1

Expert Comment

by:aturetsky
ID: 13126905
newbieME,

I have the same problem.  You mentioned you've solved yours.  How?
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

765 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