• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

How to retain value in multiple select box

 
Greenhorn
Posts: 13
  • 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

 
Sheriff
Posts: 9674
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using struts??
 
aneesh vijayakumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes...i am using struts 2
 
Marshal
Posts: 67478
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • 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
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • 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
  • 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

 
You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic