aspose file tools*
The moose likes Struts and the fly likes How to Highlight (select) all elements of a Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to Highlight (select) all elements of a "multiple select" when the page loads?" Watch "How to Highlight (select) all elements of a "multiple select" when the page loads?" New topic
Author

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

Johnny Brown
Greenhorn

Joined: Jul 27, 2009
Posts: 10
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

Joined: Sep 29, 2008
Posts: 12617

Is the ActionForm properly initialized?
Venkata Kumar
Ranch Hand

Joined: Apr 16, 2008
Posts: 110

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.


SCJP 5.0, SCWCD 5, preparing for SCDJWS
Johnny Brown
Greenhorn

Joined: Jul 27, 2009
Posts: 10
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?


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Highlight (select) all elements of a "multiple select" when the page loads?