• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to retain value in multiple select box

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9692
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using struts??
 
aneesh vijayakumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes...i am using struts 2
 
Sheriff
Posts: 67637
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Clowns were never meant to be THAT big! We must destroy it with this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic