aspose file tools*
The moose likes Struts and the fly likes Access all items in Select Box. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Access all items in Select Box. " Watch "Access all items in Select Box. " New topic
Author

Access all items in Select Box.

O. Ziggy
Ranch Hand

Joined: Oct 02, 2005
Posts: 430

Hi all,

I have to SELECT components on a jsp page.


The page has two buttons, one to add transaction and the second to remove transaction.

Add Transaction - moves items from select component 1 to select component 2
Remove Transaction - moves items from select component2 to select component 1

This all works fine but i have a problem when the user clicks on the save changes button. what should happen is that all the items in select box 2 should be saved in the database. How do i access all the items in select box 2 as i understand when the form is submitted only the selected option is sent to the Action/Server.

Thanks
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Yea, only the ids of the selected items get submitted. My elegant solution (or ugly hack) for this was to add some java script on the submit button that selected all the items in the "selected" list. I could try to track down the code if you can't figure it out yourself.

- Brent
Soumya Saha
Ranch Hand

Joined: Apr 14, 2006
Posts: 64
Hi O.Ziggy,

If the select List does not change dynamically in ur Page,
you can safely check the condition of Page Submit and use the SelectComponent2 for Database insert which u are
originally populating instead of getting it from the Form.

Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Access all items in Select Box.