This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get multi-select to display "selected" values when return to jsp page?

 
Rod McLure
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no problem selecting multiple values and saving them to the database, but I can't figure out how to "highlight" the values that were selected when I return to the jsp page. I would also like to display a string below the select box listing the values ie ${ordTyp.description } that were in the database. Thank you
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add the selected attribute to the options that you want to pre-select. You'll need to pass the previous selections so that you can re-select them using this mechanism.
 
Rod McLure
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the quick response I am looping through all the possible values for each database value selected, if there is a match I want to set mySelectVar to selected
I have not used expression language very much , so I'm guessing there is something wrong with my syntax.

here for each option I would indicate if it was selected or not
<option value="${ordTyp.id}" ${(mySelectVar eq 'selected')?'selected' : ''}>${ordTyp.description}</option>

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see nothing wrong with the syntax. Time to check values to see if they're really what you think they are.
 
Rod McLure
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sooo! sorry to waste your time. I tried working on displaying just the list of selected, and I found I was using the wrong fieldname.
Thank you
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic