| Author |
Getting elements from a list box
|
naro pad
Ranch Hand
Joined: May 07, 2008
Posts: 58
|
|
I have a form which the user enter some data into text fields and submit the form. After submitting I have a jsp page where I have use some beans and I save the objects into database. Now I have insert the following mechanism(in Javascript): I have 2 list box.The first one contains all the subjects.If the user select one subject and click on the button add the subject is remove and added to the other list box(let called it Prerequisite). Now how can I get that values from the "Prerequisite" list box and save them. With request.getParameter surely you can't I hope you understand me what I'm trying to do... Any help? Thanks
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56529
|
|
Two approaches come to mind: 1) In the form's submit handler, cause all the list's elements to be selected. That way, they'll all be submitted as the list's value. Be sure that the list is set to be multiple. 2) In the form's submit handler, create hidden elements for each entry in the list. Approach (1) is probably easier, but the 'flash' as the list elements are selected just before submission could be annoying.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: Getting elements from a list box
|
|
|