?
Solved

getting values from a listbox

Posted on 2003-02-26
14
Medium Priority
?
213 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
  • 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
Technology Partners: 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

621 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