• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Checking dynamically created multiboxes by default

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am having a bit of a problem getting to grips with checking dynamically generated multiboxes by default, and any pointers would be very much appreciated.

I understand that in order to check a multibox option, the value of the multibox item should be inlcuded in the array of values for the multibox (this is explained quite nicely at http://husted.com/struts/tips/007.html).

In order to check a value by default as I understand it, the value could be added to the array in the Form's constructor.

My problem is that I am creating the multibox items on the fly, and so do not know the values to add to the array when I construct the Form bean. How can I get around this?

Again, any insight appreciated.

Regards,

Jon
[ December 05, 2004: Message edited by: Jon Entwistle ]
 
Sheriff
Posts: 17735
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't necessarily have to do the initialization in the constructor. You said that the multiboxes are created dynamically so I assume you are iterating through some kind of collection to do so. In that case, you would initialize the default values in your Action before you forward to the JSP that displays the multiboxes.
 
Jon Entwistle
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the tip. I followed your advice and created and initialised the form bean in the preceeding Action and added it to the scope needed, it all works fine.

Cheers,

Jon
 
Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic