This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Highlight (select) all elements of a "multiple select" when the page loads?

 
Johnny Brown
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gurus,
I am trying to use a multiple select. Data comes correct and the box gets populated properly. However, no value gets selected when the page gets loaded first time.
How do I make all elements of that box get selected by default? Following is the piece of code.

Appreciate any help.

Thanks.

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the ActionForm properly initialized?
 
Venkata Kumar
Ranch Hand
Posts: 110
Firefox Browser Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the actionform initialize the array productIdSelected with all the option elements. When the page is rendered the option values that match with productIdSelected values are pre selected.
 
Johnny Brown
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow..
That was quick.

It worked!

Thank you, Venkat and David.

Venkat Divvela wrote:In the actionform initialize the array productIdSelected with all the option elements. When the page is rendered the option values that match with productIdSelected values are pre selected.


Is the ActionForm properly initialized?


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic