File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retain value in multiple select box

 
aneesh vijayakumar
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am doing an edit page. The edit page contains multiple select box. I have no issue while saving the form.
The issue is while the user updates the details.

i was able to retain the values in text field's etc, but I don,t know how to retain the value in multiple select box.

I gave the multiple select like



i tried to retain theselected values by giving

but in vain...

any help to solve this will be appreciated.

thanks in adavance.
Aneesh

 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using struts??
 
aneesh vijayakumar
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes...i am using struts 2
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post Struts questions in the Struts forum. I've moved this post there for you.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need to provide more details, like the relevant properties of the action class (specifically the property being saved to, and the property being used to do the pre-selects, and how the pre-select values are loaded by the action) at the very least as well as the complete tag usage.
 
aneesh vijayakumar
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using the struts library tags..


the multiple select is inside form tag..


I have some select box and some multiple select box in it.


i want to retain the value of this multiple select box while doing an update.

the user goes to the edit page to update details using a edit url, through which i am passing the id as a parameter.

in doing so, i am getting the object there by using the method



i am able to retain the values of checkbox's and textfield's in the page. but when it comes to select box, i am not able to retain their values.

since this page is used by the user to update his previously entered details, all the entries must be populated.

any help to solve this will be appreciated.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand why the "list" attribute is an empty list; I thought the "list" attribute was used to populate the dropdown.
 
aneesh vijayakumar
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I got it working...



the list was left empty..

this would have worked fine for the edit...
but while updating , now i checked whether any ehicle types exist in database for the object of reference and i had to give like



and it works fine

Thanks all

Aneesh

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic